Hi,
I would like to show the post category name in td_module8.php – at a different position (class of the div)
I have tried already this one, but did not work:
<?php
foreach((get_the_category()) as $category) {
echo $category->cat_name . ' ';
}
?>
I have been tried this one too – and it was almost good, but it has been added the link too (and because of the link, did not fit into the class=””):
<?php echo $this->get_category();?>
Here is how I would like to add it:
<div class=”<?php echo $this->get_module_classes();?> ADD-THE-CATEGORY-NAME-HERE“>
Because I would like to use different stylings for some posts at a specific category.
Could you please help how to do it?
-
This topic was modified 7 years by
boldix.
Hello boldix,
Unfortunately, the theme does not have any such an option for this! Do you want to exclude the link for the category? Provide your website URL and what exactly you want to achieve. If you want to remove the link for your category, it is possible to use such a custom CSS code to do this, like pointer-events: none.
Thanks for your understanding!
Hi,
Thank you for the answer!
I just need this one:
<?php echo $this->get_category();?>
– but without the link
And as I want to insert it inside like: <div class=”<?php echo $this->get_category();?>”> – it’s not enough to remove the link with css code, because it will be a class of a div.
I have tried this: <?php echo get_category();?> – but did not work
So I just need the PHP code to get the category name only.
Could you please help?
Hi,
Never tried something like that, it could be possible. Maybe there are related topics in the forum you could adapt for this. The forums are at full capacity at the moment, if we had some time we would provide more advanced solutions. Time will not permit this at the moment unfortunately.
Hello boldix,
Try to check the following example from here-> https://forum.tagdiv.com/topic/disable-one-specific-author-box/ -> https://forum.tagdiv.com/topic/hide-authors-box-of-a-certain-author/ and adjust the code for the category.
Thanks.