[Resolved] Converting WP Show Post lists to QueryLoop ~ where is “full content” ?

Home Forums Support [Resolved] Converting WP Show Post lists to QueryLoop ~ where is “full content” ?

Home Forums Support Converting WP Show Post lists to QueryLoop ~ where is “full content” ?

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #2363033
    Tamarah

    I’m converting all of my WP Show Post lists to GenerateBlocks’ QueryLoop and can’t find how to dynamically display the full content vs. excerpt.

    I’m using WP Show Post lists to dynamically display ALL of the content from one or more custom post types = “species” when the categories match. Each “species” is comprised of the heading, embedded images (no featured image), and text. When configuring the QueryLoop I figured out how to define the categories, and style the heading (as an h3) but I can’t figure out how to have ALL of the content of the CPT “species” to display (images, text content).

    An example where WP Show Posts is used:
    https://www.onthefeeder.com/wisconsin-winter-bird-identification/#Wisconsin8217s_50_Winter_Birds_Photos_Descriptions_Range_Maps

    #2363201
    Ying
    Staff
    Customer Support

    Hi Tamarah,

    There’s no such option to show full content in the query loop block.

    But you can try this snippet:

    add_filter( 'generateblocks_dynamic_content_output', function( $output, $attributes ) {
        if ( 'post-excerpt' === $attributes['dynamicContentType'] ) {
            global $post;
    
            if ( ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'full-content-query' ) !== false ) {
                $output = get_the_content();
            }
        }
    
        return $output;
    }, 10, 2 );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    And add the CSS class full-content-query to the Post excerpt block of the query loop block:
    https://www.screencast.com/t/nvC0ErPOmqNb

    #2363227
    Tamarah

    Thank you but I’d prefer to avoid custom code.

    I have almost 100 post lists setup with WP Show Posts and assumed the capabilities would carry over into GenerateBlocks once built out. When will the Full Content option be added to the query loop block?

    #2363254
    Ying
    Staff
    Customer Support

    In that case, you can use the WP Post content block instead of GB’s Post excerpt (headline block):
    https://www.screencast.com/t/8658gNEP8

    #2363279
    Tamarah

    That’s it!!!!! Thank you so much !

    #2363303
    Ying
    Staff
    Customer Support

    You are welcome ๐Ÿ™‚

    #2363307
    Tamarah

    Just realized one more parameter I cannot find. When I select multiple categories in the Query Loop block, I would like only the CPT “species” to display when they have ALL of the categories defined. Instead, I’m seeing all of the CPT that have either category defined to it when I need the CPTs that have ALL the categories defined to it.

    #2363323
    Ying
    Staff
    Customer Support

    Do you see the SELECT POST TYPE option when you select the query loop block?

    You should be able to select the CPT from the droplist.

    #2364325
    Tamarah

    Sorry, I wasn’t clear. I know where I can select the CPT “species” and define the categories. The problem is I don’t see an equivalent setting to the WP Show Posts “tax operator” (IN, NOT IN, AND, EXISTS, ETC.) that instructs the system which posts to include. AND indicates all of the categories must be defined to the species, ETC.

    For example, I want the Query Loop to pull in species that have the category “Common Birds” and “State Illinois”. Meaning, only species that have THOSE TWO categories present must be included. Right now, the Query Loop is pulling in species that have EITHER category. I think that would equate to a “tax operator” setting of EXISTS. I’m interested in AND.

    #2364363
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    We still need to add this option to GenerateBlocks – it doesn’t exist, yet.

    You can however use a custom function if you need it right now: https://community.generateblocks.com/t/query-loop-taxonomies-and-instead-of-or/968/2?u=tom

    Hope this helps!

    #2373702
    Tamarah

    I will wait for GenerateBlocks to be updated. I’m not a fan of custom code ๐Ÿ™‚

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