Here's my issue :
I have a WordPress site where I created a custom post type (named "collections
") with an article for each collection.
I'd like to add a meta description to the archive page of the custom post type
www.thesitename.com/collections
I have tried with this bit in header.php
:
<?php
if (is_category('collections'))
{
?>
<meta name="description" content="the description">
<?php } ?>
but there's nothing in the source code...
I have looked everywhere in Yoast SEO but I can't find a solution, not even on google.
Do you have ideas ?
If you want to check
post_type
archive page then you have to useis_post_type_archive()
and if you want to check the archive page of custompost_type
category then you have to useis_tax()
if (is_post_type_archive('collections'))
{
echo 'This is the collections post_type archive page';
}
Addition info but not directly related to your question.
if (is_tax('collections_cat', 'cat-1'))//<-- Replace it with your taxonomy, term name
{
echo 'This is the collections post_type, category cat 1 archive page';
}
Hope this helps!