Archived topic
Adding contents of meta description / excerpt as post content?
6 replies · Started by Michael on August 4, 2021
I'm working on improving the content of my website, and to do that I've exported the posts and dnownloads into an Excel sheet. I've been updating meta descriptions where they've been blank because the post has no text, just a video. I need to have text in the actual page, and I thought I'll just find a hook that will allow me to add the meta description to the beginning of the page.
There's too many to go in and edit pages manually to add text at the beginning, which is why am thinking of this method. Only other way would be to add it via the excel sheet and import in.
Is there an easy way to show meta description/excerpt as intro text?
Another reason for doing so is the category is grabbing the first content to show when looking at the archive, and its grabbing the video instead of intro text.
Hi there,
are you using a Manual Excerpt or SEO Meta Description on your posts ? ( If the latter what SEO plugin ? )
Hi David,
Am using the manual post_excerpt content, it's almost all done the entire posts table except for this section, so I'd be using elements to display only for that category. Am using Yoast for SEO so am guessing I'd have to duplicate post_excerpt to their equivalent ?
Hi there,
I believe you can use the_excerpt() in a Hook element for this.
I'd put this code inside the Hook Element's code area.
<?php the_excerpt() ?>
Then set the display rule to "posts - all posts" and tick "Execute PHP".
Set the hook to generate_after_entry_header. (or a hook of your preference based here - https://docs.generatepress.com/article/hooks-visual-guide/ )
Thank you so much Elvin, I did have PHP editing disabled but I'll enable it to try this.
I'm running my import now from excel with all the excerpts added, then first thing to try is your suggestion.
Works like a charm !
Thanks for letting us know. Glad you got it sorted. :D