{"id":2432,"date":"2022-04-07T13:53:12","date_gmt":"2022-04-07T05:53:12","guid":{"rendered":"https:\/\/www.intelliwolf.com\/?p=2432"},"modified":"2022-04-07T18:29:01","modified_gmt":"2022-04-07T10:29:01","slug":"how-to-display-wordpress-categories-below-astra-post","status":"publish","type":"post","link":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/how-to-display-wordpress-categories-below-astra-post\/","title":{"rendered":"How To Display WordPress Categories Below Astra Post"},"content":{"rendered":"\n

Today we're going to continue on from my series on how to customize the meta for posts using the Astra WordPress Theme<\/a>.<\/p>\n\n\n\n

How to display the WordPress categories below the content in Astra<\/h2>\n\n\n\n
  1. In functions.php<\/em>, create a function that echoes the categories.<\/li>
  2. Hook the function into astra_entry_content_after<\/em>.<\/li>
  3. Stop the category displaying in the default place under the title.<\/li><\/ol>\n\n\n\n

    This is how the post is laid out at the beginning:<\/p>\n\n\n\n

    \"screengrab<\/figure><\/div>\n\n\n\n

    The code we want to echo the categories and hook it into the right place is:<\/p>\n\n\n\n

    add_action( 'astra_entry_content_after', 'category_tag_after_post' );\n\nfunction category_tag_after_post() {\n  if ( !is_single() ) {\n    return false;\n  }\n\n  $categories = astra_post_categories();\n  echo \"<div class='entry-meta'>Category: $categories<\/div>\";\n}<\/code><\/pre>\n\n\n\n

    Put this code into the functions.php<\/em> file of your child theme<\/a>.<\/p>\n\n\n\n

    Let's go through the code in detail.<\/p>\n\n\n\n

    add_action( 'astra_entry_content_after', 'category_tag_after_post' );<\/code><\/pre>\n\n\n\n

    This tells WordPress where you want to display the category.<\/p>\n\n\n\n

    The 'astra_entry_content_after<\/em>' is one of Astra's hooks. If you want it to display somewhere else on the page, you would replace this with that location.<\/p>\n\n\n\n

    The parameter 'category_tag_after_post<\/em>' is just the name of the function. It can be anything unique that you want, as long as it's the same as the function name.<\/p>\n\n\n\n

    if ( !is_single() ) {\n  return false;\n}<\/code><\/pre>\n\n\n\n

    We 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\n

    For 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\n

    You 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\n

    But 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\n

    The 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\n

    Of 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

    \"WordPress<\/figure><\/div>\n\n\n\n

    The final result will look like this:<\/p>\n\n\n\n

    \"Screengrab<\/figure><\/div>\n\n\n\n

    If you have any questions, please drop them in the comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"

    Today we’re going to continue on from my series on how to customize the meta for posts using the Astra WordPress Theme. How to display the WordPress categories below the content in Astra In functions.php, create a function that echoes the categories. Hook the function into astra_entry_content_after. Stop the category displaying in the default place<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[19],"yoast_head":"\nHow To Display WordPress Categories Below Astra Post<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Display WordPress Categories Below Astra Post\" \/>\n<meta property=\"og:description\" content=\"Today we're going to continue on from my series on how to customize the meta for posts using the Astra WordPress Theme. How to display the WordPress categories below the content in Astra In functions.php, create a function that echoes the categories. Hook the function into astra_entry_content_after. Stop the category displaying in the default place\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/\" \/>\n<meta property=\"og:site_name\" content=\"Intelliwolf\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-07T05:53:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-07T10:29:01+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2022\/04\/2022-04-07-astra-category-to-footer-01-600x215.png\" \/>\n<meta name=\"author\" content=\"Mike Haydon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mike Haydon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/\"},\"author\":{\"name\":\"Mike Haydon\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343\"},\"headline\":\"How To Display WordPress Categories Below Astra Post\",\"datePublished\":\"2022-04-07T05:53:12+00:00\",\"dateModified\":\"2022-04-07T10:29:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/\"},\"wordCount\":386,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2022\/04\/2022-04-07-astra-category-to-footer-01-600x215.png\",\"keywords\":[\"Astra\"],\"articleSection\":[\"Theme Customization\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/\",\"url\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/\",\"name\":\"How To Display WordPress Categories Below Astra Post\",\"isPartOf\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/intelliwolf.com\/wp-content\/uploads\/2022\/04\/2022-04-07-astra-category-to-footer-01-600x215.png\",\"datePublished\":\"2022-04-07T05:53:12+00:00\",\"dateModified\":\"2022-04-07T10:29:01+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#primaryimage\",\"url\":\"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/2022\/04\/2022-04-07-astra-category-to-footer-01.png\",\"contentUrl\":\"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/2022\/04\/2022-04-07-astra-category-to-footer-01.png\",\"width\":744,\"height\":266},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.intelliwolf.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Theme Customization\",\"item\":\"https:\/\/www.intelliwolf.com\/category\/theme-customization\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How To Display WordPress Categories Below Astra Post\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.intelliwolf.com\/#website\",\"url\":\"https:\/\/www.intelliwolf.com\/\",\"name\":\"Intelliwolf\",\"description\":\"WordPress, Web Design and Coding Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.intelliwolf.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.intelliwolf.com\/#organization\",\"name\":\"Intelliwolf\",\"url\":\"https:\/\/www.intelliwolf.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/intelliwolf-logo-300t.png\",\"contentUrl\":\"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/intelliwolf-logo-300t.png\",\"width\":300,\"height\":100,\"caption\":\"Intelliwolf\"},\"image\":{\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343\",\"name\":\"Mike Haydon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.intelliwolf.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g\",\"caption\":\"Mike Haydon\"},\"sameAs\":[\"https:\/\/intelliwolf.com\/about-mike-haydon\/\"]}]}<\/script>\n","yoast_head_json":{"title":"How To Display WordPress Categories Below Astra Post","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/","og_locale":"en_US","og_type":"article","og_title":"How To Display WordPress Categories Below Astra Post","og_description":"Today we're going to continue on from my series on how to customize the meta for posts using the Astra WordPress Theme. How to display the WordPress categories below the content in Astra In functions.php, create a function that echoes the categories. Hook the function into astra_entry_content_after. Stop the category displaying in the default place","og_url":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/","og_site_name":"Intelliwolf","article_published_time":"2022-04-07T05:53:12+00:00","article_modified_time":"2022-04-07T10:29:01+00:00","og_image":[{"url":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2022\/04\/2022-04-07-astra-category-to-footer-01-600x215.png"}],"author":"Mike Haydon","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mike Haydon","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#article","isPartOf":{"@id":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/"},"author":{"name":"Mike Haydon","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343"},"headline":"How To Display WordPress Categories Below Astra Post","datePublished":"2022-04-07T05:53:12+00:00","dateModified":"2022-04-07T10:29:01+00:00","mainEntityOfPage":{"@id":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/"},"wordCount":386,"commentCount":0,"publisher":{"@id":"https:\/\/www.intelliwolf.com\/#organization"},"image":{"@id":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#primaryimage"},"thumbnailUrl":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2022\/04\/2022-04-07-astra-category-to-footer-01-600x215.png","keywords":["Astra"],"articleSection":["Theme Customization"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/","url":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/","name":"How To Display WordPress Categories Below Astra Post","isPartOf":{"@id":"https:\/\/www.intelliwolf.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#primaryimage"},"image":{"@id":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#primaryimage"},"thumbnailUrl":"https:\/\/intelliwolf.com\/wp-content\/uploads\/2022\/04\/2022-04-07-astra-category-to-footer-01-600x215.png","datePublished":"2022-04-07T05:53:12+00:00","dateModified":"2022-04-07T10:29:01+00:00","breadcrumb":{"@id":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#primaryimage","url":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/2022\/04\/2022-04-07-astra-category-to-footer-01.png","contentUrl":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/2022\/04\/2022-04-07-astra-category-to-footer-01.png","width":744,"height":266},{"@type":"BreadcrumbList","@id":"https:\/\/www.intelliwolf.com\/how-to-display-wordpress-categories-below-astra-post\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.intelliwolf.com\/"},{"@type":"ListItem","position":2,"name":"Theme Customization","item":"https:\/\/www.intelliwolf.com\/category\/theme-customization\/"},{"@type":"ListItem","position":3,"name":"How To Display WordPress Categories Below Astra Post"}]},{"@type":"WebSite","@id":"https:\/\/www.intelliwolf.com\/#website","url":"https:\/\/www.intelliwolf.com\/","name":"Intelliwolf","description":"WordPress, Web Design and Coding Tutorials","publisher":{"@id":"https:\/\/www.intelliwolf.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.intelliwolf.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.intelliwolf.com\/#organization","name":"Intelliwolf","url":"https:\/\/www.intelliwolf.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/","url":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/intelliwolf-logo-300t.png","contentUrl":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-content\/uploads\/intelliwolf-logo-300t.png","width":300,"height":100,"caption":"Intelliwolf"},"image":{"@id":"https:\/\/www.intelliwolf.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/person\/7209e3ff14822e4d70d5f194a310f343","name":"Mike Haydon","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.intelliwolf.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d5f4754fae310a04dede91d15e57c8a0?s=96&d=mm&r=g","caption":"Mike Haydon"},"sameAs":["https:\/\/intelliwolf.com\/about-mike-haydon\/"]}]}},"_links":{"self":[{"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/posts\/2432"}],"collection":[{"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/comments?post=2432"}],"version-history":[{"count":8,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/posts\/2432\/revisions"}],"predecessor-version":[{"id":2508,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/posts\/2432\/revisions\/2508"}],"wp:attachment":[{"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/media?parent=2432"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/categories?post=2432"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress-757293-2559390.cloudwaysapps.com\/wp-json\/wp\/v2\/tags?post=2432"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}