How to add 'Category' in posts

Dear support,

Tags is shown at the end of a post of my Renew theme (Pro). Now I would like to add the category of the posts too. I’m looking everywhere, I can’t find it. Is there a simple slider somewhere? Or should I take a different path?

Kind Regards, V.

Hi There,

Thanks for writing in! You can use Recent Posts shortcode to show related posts under a category using it’s category parameter. Please follow the guide here (http://demo.theme.co/integrity-1/shortcodes/recent-posts/).

Hope that helps.

Thanks!

My question is different however.

At the end of my post, the tags is shown. But subject is not. I just want to show the subject of the post

For example:


Title: Healthy fruits to eat daily

Blah blah blah (content etc etc)

Tags: Fruit, Sport, Vitamins
Category: Healthy lifestyle

Tags are shown already. But “Category: …” is not shown.

Hi There,

In that case, you need to change a template modification. First make sure that you have setup a child theme correctly by following this guide (https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57).

Then create a file named _content-post-footer.php on the following location (/wp-content/themes/x-child/framework/views/renew/) and then copy the following code into that, save the changes.

<?php

// =============================================================================
// VIEWS/RENEW/_content-post-footer.php
// -----------------------------------------------------------------------------
// Standard <footer> output for various posts.
// =============================================================================

?>

<?php if ( has_tag() ) : ?>
  <footer class="entry-footer cf">
    <?php echo get_the_tag_list( '<p><i class="x-icon-tags" data-x-icon="&#xf02c;"></i>'. __( 'Tags:', '__x__'), ', ', '</p>' ); ?>
    <?php echo get_the_category_list(); ?>
  </footer>
<?php endif; ?>

Hope that helps.

I do appreciate your help, but it doesn’t help, yet.

I get the impression our suggestion/code is focussed on the x theme, but I use the Pro theme. Is it that? If not, I need to look into the matter more deeply.

Hi there,

Sorry for the confusion. If you’re using Pro theme, you can download the Pro child theme from your Themeco dashboard and setup your child in the similar way. Then create the file under your Pro child theme (pro-child/framework/views/renew/) and it should function.

Thanks!

Hi support, I’ve set up Pro child theme succesfully a little while ago. I created a php file as suggested at the location as suggested. And it doesn’t work.

Question: is the file (_content-post-footer.php) with the code as given, suitable for the Pro (child) theme I’m using?

If it is, I need to find out why it isn’t working…

Kind Regards, V.

Hi There,

Both X theme & Pro has the same template file which you can locate under (/wp-content/themes/pro/framework/views/renew/_content-post-footer.php).

Could you please provide us with your login credentials to check your issue. Please provide following information:

Set it as Secure Note

  • Link to your site
  • WordPress Admin username / password
  • FTP credentials

Thanks!

Thank you for your answer. Now I know that for the future too, very helpful in similar situations.

I looked carefully now and found out what is going on. It works (but I didn’t notice it because the category looked like an extension of the tags). What is missing is a symbol for the category and the word ‘Category’. Now it is just a simple dot.

Question: how to get the right symbol in front of the category, and the word ‘Category:’?

Just to be sure, I will put an image here about how it looks like now.

This way, it might not be necessary to give login credentials and such.

(Tag: Weather)
(Category: Tea)

Kind Regards, V.

Hi there,

Please add this custom CSS:

.entry-title:before {
    display: none;
}

Hope this helps.

Yes Jade, that helped. As that was another question I might have asked later :slight_smile:

This question, of this thread, is pointed to the grey field with the tag(s) and category shown.
Symbol of tag + ‘Tag:’ [Tags]
No symbol of category + no ‘Category:’ [Category.

I would like to have the category symbol, the word ‘Category:’ too, in the same way as correctly done with tag (also in the grey field).

Kind Regards, V.

Hi,

To fix it, please replace code in your _content-post-footer.php with this

<?php

// =============================================================================
// VIEWS/RENEW/_CONTENT-POST-FOOTER.PHP
// -----------------------------------------------------------------------------
// Standard <footer> output for various posts.
// =============================================================================

?>

<?php if ( has_tag() ) : ?>
  <footer class="entry-footer cf">
    <?php echo get_the_tag_list( '<p><i class="x-icon-tags" data-x-icon="&#xf02c;"></i>'. __( 'Tags:', '__x__'), ', ', '</p>' ); ?>
     <?php echo '<i class="x-icon-tags" data-x-icon="&#xf02c;"></i>'.__( 'Categories:', '__x__').get_the_category_list( ','  ); ?>
  </footer>
<?php endif; ?>

Hi Paul, you did understand my question in detail. And gave exactly what I wanted. Thank you very much Paul!

You’re most welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.