Updated on October 04, 2019

Looking for a way to display comma-separated linked categories for posts output by Oxygen‘s Easy Posts component?

Just add the following in the Template PHP wherever you want to show the categories:

<?php echo '<div class="oxy-post-categories">Categories: ' . do_shortcode( "[oxygen data='terms' taxonomy='category' separator=', ']" ) . '</div>'; ?>

To NOT show the above when a post has not been assigned manually to any category i.e., it has the default Uncategorized category, change the above to:

<?php
if ( ! in_category( 1 ) ) {
	echo '<div class="oxy-post-categories">Categories: ' . do_shortcode( "[oxygen data='terms' taxonomy='category' separator=', ']" ) . '</div>';
}
?>

You may want to also add CSS similar to the following to add some space above/below the categories:

.oxy-post-categories {
  margin-top: 20px;
}

Reference

https://www.isitwp.com/hide-posts-in-the-uncategorized-category/

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
  • magnifiercross
    >
    linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
    %d bloggers like this: