Wordpress Meta Description Not Showing in Frontend
Today Discussed wordpress meta description Not showing seo yoast plugin problem. How to handle this task. First one seo yoast set up this plugin.Wordpress Meta Description Not Showing in Frontend |
Seo Yoast Plugin sometime not working in meta description is not showing in frontend this problem seo issue is empty meta description. This case handle is very simple. following code copy and paste header.php
<meta name="description" content="<?php
// if home page output blog name and description
if (is_home()) { bloginfo('name'); echo " - "; bloginfo('description');}
// if single page output either excerpt if available or post title
elseif (is_single()) {
$custommeta = get_post_meta($post->ID, "MetaDescription", true);
// checks ot see if the custom field MetaDescription is not empty
if ($custommeta !=='') {echo $custommeta;}
// check if excerpt exists for the post and output it if it does
elseif (!empty($post->post_excerpt)) {the_excerpt();}
// if there's no custom field or excerpt output the post title
else {single_post_title('', true);}
}
// if category page output the category description
elseif (is_category()) {echo category_description();}
// if it's any other page display this generic description
else { echo 'Add your own generic site description here';}
?>"
/>
after check it your site view source now showing meta description. more details please visite developerinvention.in
wordpress