How to make so that the wordpress tag in each post is automatically filled, taking the first piece of text from the post itself, and on the main one directly from bloginfo('description'); ?
1 answer
In the header.php file, specify the output of a specific description depending on the condition:
<meta name="description" content="<?php if ( is_front_page() ) { // при выводе главной страницы сайта echo $post_description; } else { bloginfo('description'); } ?>" /> First you need to fill the $post_description variable in the way you want:
if(have_posts()){ while (have_posts()){ the_post(); $post_description = get_the_excerpt(); // например, используете цитату } } |