- This topic has 15 replies, 2 voices, and was last updated 3 months, 3 weeks ago by
David.
-
AuthorPosts
-
November 1, 2020 at 6:45 am #1513347
Chitika
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 #1513512David
StaffCustomer SupportHi there,
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:
https://docs.generatepress.com/article/hooks-element-overview/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/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 #1522619David
StaffCustomer SupportYou would use the
generate_after_entry_title
Hook with a priority of5
You can see all hooks here:https://docs.generatepress.com/article/hooks-visual-guide/
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.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/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 #1523412David
StaffCustomer SupportHow have you added the description text into the Entry Header ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 9, 2020 at 5:24 am #1523691Chitika
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 #1523713David
StaffCustomer SupportSee here:
Your site has content being displayed before the Post Title – this is not a standard function of the theme. So how did you add this Content ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 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 #1523725David
StaffCustomer SupportYou have this CSS:
.entry-header { display: flex; flex-direction: column-reverse; }
Delete that and it will return the order to below the title.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 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 #1523954David
StaffCustomer SupportI can still the CSS on your site – can you clear your plugin/server caches ?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 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. -
AuthorPosts
- You must be logged in to reply to this topic.