[Resolved] Display Post Excerpt

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Display Post Excerpt

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #29159
    vikingruler
    Participant

    Hello 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

    #29174
    elvin
    Moderator

    Hi 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. 🙂

    #29272
    vikingruler
    Participant

    Hello 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

    #29310
    elvin
    Moderator

    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?

    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.

    #29717
    vikingruler
    Participant

    Hello 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

    #29732
    elvin
    Moderator

    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.

    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/geubPxmQ

    #29768
    vikingruler
    Participant

    Hello 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

    #29772
    elvin
    Moderator

    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.

    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.

    #29868
    vikingruler
    Participant

    Thank you.

    #29881
    elvin
    Moderator

    No problem. 🙂

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.