• Resolved joneiseman

    (@joneiseman)


    I’m trying to migrate from WP Show Posts to the Generate Blocks Query Loop and I found one feature that’s missing. WP Show Posts will check for the presence of the “more” tag in the post content to decide whether to call the_content or the_excerpt. I can’t figure out a way to accomplish this with the Query Loop. I can have the query loop output the Post Excerpt block or the Post Content block but I can’t get it to choose which one based on the presence of the “more” tag. Maybe a new block type is required to do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter joneiseman

    (@joneiseman)

    I was able to use the Post Excerpt block along with the “get_the_excerpt” filter to get this working. Something like this:

    add_filter( 'get_the_excerpt', 'my_the_excerpt', 10, 2 );
    function my_the_excerpt( $excerpt, $post ) {
        if ( strpos( $post->post_content, '<!--more-->' ) ) {
            return get_the_content();
        }
        return $excerpt;
    }
    
    Plugin Support ying

    (@yingscarlett)

    Hi @joneiseman,

    Glad you’ve figured it out 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WP Show Posts migration’ is closed to new replies.