If you wan to show Category between Post’s Content. So simply use simple php code on your WordPress custom theme.
How To Show Category in Post Content
- Open functions.php file then paste given code.
function display_post_categories($atts) { if (!is_single()) { return ''; } $categories = get_the_category(); if (!$categories) { return ''; } $category_links = array(); foreach ($categories as $category) { $category_links[] = '<a href="' . get_category_link($category->term_id) . '">' . $category->name . '</a>'; } $output = implode(', ', $category_links); return $output; } add_shortcode('post_categories', 'display_post_categories');
- Then SAVE it.
- Now use [post_categories] short code for where you want to show category.
Hope this code will work on your custom theme. Thanks for visiting here.