Published on Oct 2, 2019

How to show categories in Oxygen’s Easy Posts

Sridhar Katakam

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/

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right