What is the code to add Blog Categories and Tags back?

As requested this is a new thread. What is the code to add the blog categories and tags back into the theme since they have been removed and there is no toggle option available to turn on or off?

I highly recommend this to become a feature in the theme as these categories and tags are important for SEO.

Hello @powersnw,

Thanks for writing to us.

In order to enable the post category, tag I would suggest you please go to the Theme options —>Blog —>Post meta. Please have a look at the screenshot below.

Thanks

That is and has been turned on. Categories didnt show and neither did the tags. Adding the following code below, from another user asking this same question on the forum put them there however in another post I was told this code is incorrect and to maker a new post about this:

// Begin - Add Category and Tags
function x_icon_entry_meta() {

$date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>',
  esc_attr( get_the_date( 'c' ) ),
  esc_html( get_the_date() )
);

 //
// Categories.
//

if ( get_post_type() == 'x-portfolio' ) {
  if ( has_term( '', 'portfolio-category', NULL ) ) {
    $categories        = get_the_terms( get_the_ID(), 'portfolio-category' );
    $separator         = ', ';
    $categories_output = '';
    foreach ( $categories as $category ) {
      $categories_output .= '<a href="'
                          . get_term_link( $category->slug, 'portfolio-category' )
                          . '" title="'
                          . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                          . '"><i class="x-icon-bookmark" data-x-icon=""></i> '
                          . $category->name
                          . '</a>'
                          . $separator;
    }

    $categories_list = sprintf( '<span>%s</span>',
      trim( $categories_output, $separator )
    );
  } else {
    $categories_list = '';
  }
} else {
  $categories        = get_the_category();
  $separator         = ', ';
  $categories_output = '';
  foreach ( $categories as $category ) {
    $categories_output .= '<a href="'
                        . get_category_link( $category->term_id )
                        . '" title="'
                        . esc_attr( sprintf( __( "View all posts in: &ldquo;%s&rdquo;", '__x__' ), $category->name ) )
                        . '"><i class="x-icon-bookmark" data-x-icon=""></i> '
                        . $category->name
                        . '</a>'
                        . $separator;
  }

  $categories_list = sprintf( '<span>%s</span>',
    trim( $categories_output, $separator )
  );
}

if ( x_does_not_need_entry_meta() ) {
  return;
} else {
  printf( '<p class="p-meta">%1$s%2$s</p>',
    $date,
    $categories_list
  );
}

}

function add_tags(){
if ( has_tag() ) : ?>

<?php echo get_the_tag_list(); ?> <?php endif; } add_action('x_after_view_global__content', 'add_tags');

// End - Add Category and Tags

Hi @powersnw,

There is no additional code required to show the category and tags in blog. You need to enable to option as shown by my colleague. I have checked your staging site and found that the tags and categories are showing.

Thanks

Please feel free to refresh the site. I removed the code from functions.php and there are no tags or categories displaying. The post meta is set on and nothing is working. I also have ALL plugins disabled so it is not a plugin conflict. Still not working.

Hi @powersnw,

I have checked the stack and found that you are using the Icon which does not show the meta values. You need to select a different stack for that. I have changed it to Integrity and now it is showing.

Thanks

So we are back to my original point of removing important features that are needed for proper SEO with no ability to turn it on without adding code to the functions.php file which was mentioned in previous posts but then I was told that code is not correct. I now have to change a theme to something different and then recreate the Icon look through CSS instead of the built in feature of the categories and tags of Wordpress to be displayed. This is not the first time someone has mentioned this and I assume will not be the last. Why is this feature removed?

Hi @powersnw,

The Icon stack never shows the meta values. Still, I will check with our development team to see if anything can be done on this. If possible, I will add this as a feature request for future consideration.

Thanks

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