Site logo

Archived topic

Converting WP Show Post lists to QueryLoop ~ where is "full content" ?

10 replies · Started by _blank on October 4, 2022

Viewing posts 1–11 of 11

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

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

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?

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

You are welcome :)

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.

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.

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.

I will wait for GenerateBlocks to be updated. I'm not a fan of custom code :)

This archived topic is closed to new replies.