- This topic has 15 replies, 2 voices, and was last updated 3 years, 4 months ago by David.
-
AuthorPosts
-
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 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/
November 7, 2020 at 8:38 pm #1522149ChitikaHow 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 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.
November 8, 2020 at 8:11 pm #1523197ChitikaYou 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 SupportHow have you added the description text into the Entry Header ?
November 9, 2020 at 5:24 am #1523691ChitikaNovember 9, 2020 at 5:25 am #1523693ChitikaBTW, 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 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 ?
November 9, 2020 at 5:44 am #1523716ChitikaActually that is the “Yoast Meta Description” as you suggested with generate_after_entry_title hook.
November 9, 2020 at 5:46 am #1523721ChitikaBTW, I’m also using Yoast Breadcrumbs code to display using generate_before_content hook.
November 9, 2020 at 5:50 am #1523725DavidStaffCustomer SupportYou have this CSS:
.entry-header { display: flex; flex-direction: column-reverse; }
Delete that and it will return the order to below the title.
November 9, 2020 at 6:45 am #1523799ChitikaI have deleted it. But it still shows about title.
I have cleared all the cache too.November 9, 2020 at 6:49 am #1523954DavidStaffCustomer SupportI can still the CSS on your site – can you clear your plugin/server caches ?
November 9, 2020 at 9:23 pm #1524775ChitikaThanks @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.