Site logo

Archived topic

Can I make wp-show-posts use text from containers in their excerpt?

5 replies · Started by Andrei on May 21, 2021

Viewing posts 1–6 of 6

Hi!
I created an article in which I put the text in Generate blocks containers because I wanted it to have a specific design. However, the WP-show-posts plugin does not recognize the content when creating the post thread and, as such, no excerpt is shown in the thread.
Is there a way to make the wp-show-posts thread "see" the content in a container?

Hi there,

thats a limitation of the WP excerpt function - it ignores any nested block content.
Are you just wanting to display the plain text for the excerpt?

Hi, David,

Yes. I was hoping that maybe I could make the excerpt be extracted from Yoast's meta description or something to that effect. That way it wouldn't matter how the content of the post was formatted.
Would it be possible for you to make an update to WP show posts that would allow me to use the meta description in the thread for the excerpt?

That may be easier to do :) Try this:

1. Create a new Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/

2. Add this code to the Hook text area:


<div class="custom-excerpt">
<?php echo get_post_meta(get_the_ID(), '_yoast_wpseo_metadesc', true); ?>
</div>

3. From the Hook List, select Custom Hook and type in the field: wpsp_after_title
4. Check the Execute PHP option.

5. Set the Display Rules to Entire Site. The hook will only get fired when there is a WPSP list on the page.

I see. Cool. Thanks!

You're welcome

This archived topic is closed to new replies.