Hello fellow stackexchangers ! :D Im working on a custom header meta description.

I have on archives.php a sort of dynamic description :

Hello fellow <?php $category = get_the_category();
echo $category[0]->cat_name;?> one variable is starting 
<?php $i = 1; while (have_posts() && $i < 5) : the_post(); ?>
with a title <?php the_title(); ?><?php if($i<4){echo',';}?>
<?php if($i==4){echo' dot!!!!!';}?><?php $i++;endwhile; ?>
<?php rewind_posts(); ?>

Do you have any suggestion to mimic this "dynamic" description for metadescription with a simple function


add_action('wp_head', 'meta_description', 3); 
function meta_description() {


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.