• Resolved ftcanon

    (@ftcanon)


    I’m using the posts block on a newsletter, and I’ve noticed that the excerpts are not showing. When I choose full post layout, the post content shows up, but for some reason, I can’t get the excerpt to show when I choose any of the other layouts.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Stefano Lissa

    (@satollo)

    Hi, sometime we experimented interference between themes and post extraction made by Newsletter. Which theme are your using?

    Stefano.

    Thread Starter ftcanon

    (@ftcanon)

    Hi Stefano.
    We’re using a custom theme based off of HTML5Blank (I think). We were able to create a workaround to get the excerpt by changing line 52 in the helper file to use $post->post_excerpt instead of get_the_excerpt($post->ID).

    Thanks.

    Same problem with “Blog posts” block here, posts have no excerpt, excerpt should be autogenerated from content but stayed empty in Newsletter plugin.

    Twenty Twenty 1.7, Newsletter 7.1.5, no other plugins.

    Our workaround for includes/helper.php

    function tnp_post_excerpt($post, $length = 30) {
    
    $temp = $post;
    setup_postdata($post);
    
       $excerpt = tnp_delete_all_shordcodes_tags(get_the_excerpt($post->ID));
    
    wp_reset_postdata();
    $post = $temp;
    
        $excerpt = wp_trim_words($excerpt, $length);
        return $excerpt;
    }

    Did not track it down further, but it seems somewhere in the process of get_the_excerpt(…) a proper set up post (as if within a loop) is required.

    Plugin Author Stefano Lissa

    (@satollo)

    Hi, thank you for reporting a such detailed configuration, tomorrow I’ll replicate it.

    Stefano.

    Did you manage to track it down and will there be some sort of fix available?

    If you need help or testing support, let me know.

    Plugin Author Stefano Lissa

    (@satollo)

    We’re reworking the loop in the posts block. The original attempts get consistent results on different blogs with different themes and plugins (for example if you have a composer there could be no text to create the excerpt and you need to leave filters active, while sometimes you get non executed shortcodes returned ’cause the block is rendered in the admin context…).

    Stefano.

    Thanks for update.

    Maybe an approach similar to wp_trim_excerpt() would work.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Excerpt not showing in posts block’ is closed to new replies.