if ( !is_single() ) {\n return false;\n}<\/code><\/pre>\n\n\n\nWe only want this to display on single blog posts. If it's a page or category, the code will stop processing at this point.<\/p>\n\n\n\n
If you want this to run on single posts, category pages and the home page (assuming it's not a static page), use this code:<\/p>\n\n\n\n
if (!is_single() AND !is_archive() AND !is_home()) {\n return false;\n}<\/code><\/pre>\n\n\n\nFor the final section,<\/p>\n\n\n\n
$categories = astra_post_categories();\necho \"<div class='entry-meta'>Category: $categories<\/div>\";<\/code><\/pre>\n\n\n\nYou could put this in one line, like so:<\/p>\n\n\n\n
echo \"<div class='entry-meta'>Category: \" . astra_post_categories() . \"<\/div>\";<\/code><\/pre>\n\n\n\nBut I like to split it out, both for readability and in case I later want to add in things like tags or last updated date.<\/p>\n\n\n\n
The HTML wrapper is optional. If you don't want it to be the same style as the Astra meta under the title, you could just wrap it in <p><\/p><\/em>.<\/p>\n\n\n\nThe last step is to turn off displaying the categories in the default place.<\/p>\n\n\n\n
Go to Customizer<\/em> -> Blog<\/em> -> Single Post<\/em>, look for the Meta<\/em> heading and turn off the visibility of Category<\/em>.<\/p>\n\n\n\nOf course if you want it to stay where it is and have the categories display at the top and bottom, that's perfectly fine too.<\/p>\n\n\n\n