Home › Forums › Pro Support › Display Post Excerpt
- This topic has 9 replies, 2 voices, and was last updated 2 years, 4 months ago by
elvin.
-
AuthorPosts
-
April 12, 2021 at 2:12 pm #29159
vikingruler
ParticipantHello there,
I want to display a post with excerpt, on the home page of GeneratePress Premium, using WP Show Posts Pro within GenerateBlocks.
I want to display the same post, heading only, on the Category page of GeneratePress.
The solution for the Category page of GeneratePress is simple.
As I do not want to write a manual excerpt on the post page, so that this does not to appear on the Category page of GeneratePress, is the PHP snippet given on this support ticket: https://wpshowposts.com/support/topic/excerpt-length-not-working/ the best solution available to me?
Thank you.
Kallad
April 12, 2021 at 5:41 pm #29174elvin
ModeratorHi there,
To clarify: You want to place WPSP lists on 2 separate places?
If so, you’d have to create 2 WPSP lists.
One for the homepage and one for the category page.
For the homepage:
Yeah if you’re going to use “full content”, You’ll need the PHP snippet from my answer on the topic you’ve linked.For the category page:
Where are you trying to place it? If it’s on the right sidebar, I believe you can place a text widget on the right sidebar area and then add your shortcode within that text widget. Text widgets run shortcodes. 🙂April 15, 2021 at 12:52 am #29272vikingruler
ParticipantHello Elvin
To answer your question: No, I only want to use 1 WPSP list on the home page.
I am using GeneratePress premium theme, and on the home page I am styling the layout using GenerateBlocks.
I am using the default Post and Archive layout of GeneratePress, through the Customizer, to achieve the Post and Category page layouts. This is not where my problem lies.
Here is the problem: Because I am only using the heading of the Post, in a list type layout, on the Category page of GeneratePress, this is affecting the layout I am wanting for the same Post on the home page…where I want an excerpt, which I am setting from within WPSP.
So my question is: How do I get the Post on the home page, displayed with WPSP, to show an excerpt, when I have set the same Post on the Category page of GeneratePress, to display no excerpt?
Thank you.
Kallad
April 15, 2021 at 10:58 pm #29310elvin
ModeratorSo my question is: How do I get the Post on the home page, displayed with WPSP, to show an excerpt, when I have set the same Post on the Category page of GeneratePress, to display no excerpt?
Ah I see.
We can try filtering the content type.
Try this PHP snippet:
add_filter( 'wpsp_settings', function($settings){ if(18984 == (int) $settings['list_id']){ if(is_category()){ $settings['content_type'] = 'none'; } } return $settings; });
Change
18984
to the WPSP list id you’re using.On the WPSP setting page, leave the content to “full”. The snippet will handle the condition for the category archive pages.
April 28, 2021 at 3:01 pm #29717vikingruler
ParticipantHello Elvin,
No this is not working.
Remember, I have set post title only, and no excerpt, for all posts that appear on all archive pages – this has been done from within GeneratePress.
I have one post that I am displaying on the home page: Using WPSP and GenerateBlocks. For this post only, I want the post title AND an excerpt.
How do I get this done?
Thank you.
Kallad
April 28, 2021 at 10:15 pm #29732elvin
ModeratorI have one post that I am displaying on the home page: Using WPSP and GenerateBlocks. For this post only, I want the post title AND an excerpt.
I assume this WPSP isn’t being used anywhere else except the home page?
If that’s the case, you can edit that one WPSP list you’re using to display only the post title and excerpt.
You can uncheck the post meta and the featured image on its appropriate tabs on the WPSP edit page.
Removing image – https://share.getcloudapp.com/QwuEwWLb
Removing meta – https://share.getcloudapp.com/geubPxmQApril 29, 2021 at 1:43 pm #29768vikingruler
ParticipantHello Elvin
I found the problem.
The post that is displayed on the home page, using WPSP shortcode in a shortcode block, within a GenerateBlocks container, is from a prototype post layout reusable block.
It does not seem as though WPSP or GeneratePress can effectively extract the content excerpt of the post, as I have all content within a GenerateBlocks container.
As soon as I remove the container, all settings for the post, as determined independently by WPSP and by GeneratePress, work 100%.
If there is a way to retain the GenerateBlocks container, and extract the content excerpt, as per the settings of WPSP and of GeneratePress, please let me know, as this would be my best case scenario.
Otherwise, I will leave things as is.
Thank you for your support in this matter.
Kallad
April 29, 2021 at 4:15 pm #29772elvin
ModeratorIf there is a way to retain the GenerateBlocks container, and extract the content excerpt, as per the settings of WPSP and of GeneratePress, please let me know, as this would be my best case scenario.
This is a known bug with WordPress. It’s not able to load nested GB containers for excerpt. And in some cases when it does, the stylesheets won’t apply/load.
May 4, 2021 at 5:10 am #29868vikingruler
ParticipantThank you.
May 4, 2021 at 7:26 pm #29881elvin
ModeratorNo problem. 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.