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 ?
2
Answers
WordPress is written in
PHP
, which means thatHTML
like that will not work by itself. It is for this reason that in most tracking codes are established by including something along the lines of<?php include_once("analytics.php"); ?>
In your case, you would have to
echo
any HTML elements like this. Like so:Addition info but not directly related to your question.
Hope this helps!