- This topic has 15 replies, 2 voices, and was last updated 3 months, 3 weeks ago by David.
November 1, 2020 at 6:45 am #1513347Chitika
I write my meta description using Yoast Plugin.
There are about 400 posts.
Now I want to display this meta information below post title, just like branded sites.
Is it possible?November 1, 2020 at 8:12 am #1513512DavidStaffCustomer Support
you can display the yoast meta description using this PHP snippet:
<?php echo get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true); ?>
You can use a Hook Element to add that meta where you require it:November 7, 2020 at 8:38 pm #1522149Chitika
How to display it after post title.
Also I would like it to be H3 Tag with some color coding.November 8, 2020 at 6:56 am #1522619DavidStaffCustomer Support
You would use the
generate_after_entry_titleHook with a priority of
You can see all hooks here:
Changing it to H3 you could try this instead:
<?php echo '<h3>' . get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true) . '</h3>'; ?>
Not sure it will work correctly but that as much as we can do as we’re not in control of Yoasts shortcode.November 8, 2020 at 8:11 pm #1523197Chitika
You would use the generate_after_entry_title Hook with a priority of 5
I have used the above location. But it displays before post title or after breadcrumbs. I even made the priority of 3. Same result.November 9, 2020 at 1:38 am #1523412DavidStaffCustomer SupportNovember 9, 2020 at 5:24 am #1523691Chitika
Frankly I didn’t understand your question.
I added the raw code you gave me.November 9, 2020 at 5:25 am #1523693Chitika
BTW, this is the support answer received from plugin support.
https://wordpress.org/support/topic/display-yoast-meta-description-after-post-title/#post-13637192November 9, 2020 at 5:42 am #1523713DavidStaffCustomer SupportNovember 9, 2020 at 5:44 am #1523716Chitika
Actually that is the “Yoast Meta Description” as you suggested with generate_after_entry_title hook.November 9, 2020 at 5:46 am #1523721Chitika
BTW, I’m also using Yoast Breadcrumbs code to display using generate_before_content hook.November 9, 2020 at 5:50 am #1523725DavidStaffCustomer SupportNovember 9, 2020 at 6:45 am #1523799Chitika
I have deleted it. But it still shows about title.
I have cleared all the cache too.November 9, 2020 at 6:49 am #1523954DavidStaffCustomer SupportNovember 9, 2020 at 9:23 pm #1524775Chitika
Thanks @David. It seems the Varnish and Cloudflare cache are taking some time to clear.
Now I see the changes. Also, I tried to make the color of the meta to Red and it works.
So probably the <h3> tag also should work.
- You must be logged in to reply to this topic.