I’m using both the category description and the meta description fields for my categories.
I would like to list each of the categories in the body of my homepage and use the meta description like you would use a post excerpt on a category or archive page.
It would look something like this…
[thumbnail from latest post in the category]
[category meta description]
I’ve got the code figured out for the name and thumbnail. I just can’t figure out if or how I can display the description. What variable or PHP code do I need to use to display the meta description?
I guess I’ll just talk to myself since no one else is…
Tried a bunch of things. Closest I’m getting is …
<?php echo get_post_meta($post->ID, '_yoast_wpseo_metadesc', true); ?>
But that displays the WPSEO description from the post and not the category.
It seems like I would need something like get_category_meta but from what I can see, that is a different plugin. I’ve replaced $post->ID with a number of different category-related things but they just yield errors or nothing at all.
Anyone care to chime in?
I’m also a little confused by this one and as to why WordPress isn’t putting out the meta description in categories despite descriptions being entered. That was until I entered this into the Taxonomies area under description for categories:
But, how does that translate to being able to call the description of a category from the parent category or another page of the site?
- The topic ‘Category Page Meta Descriptions’ is closed to new replies.