- This topic has 10 replies, 3 voices, and was last updated 2 years, 4 months ago by
Tamarah.
-
AuthorPosts
-
October 4, 2022 at 9:47 am #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_MapsOctober 4, 2022 at 12:22 pm #2363201Ying
StaffCustomer SupportHi 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/nvC0ErPOmqNbOctober 4, 2022 at 12:44 pm #2363227Tamarah
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?
October 4, 2022 at 1:06 pm #2363254Ying
StaffCustomer SupportIn that case, you can use the WP Post content block instead of GB’s Post excerpt (headline block):
https://www.screencast.com/t/8658gNEP8October 4, 2022 at 1:37 pm #2363279Tamarah
That’s it!!!!! Thank you so much !
October 4, 2022 at 2:13 pm #2363303Ying
StaffCustomer SupportYou are welcome ๐
October 4, 2022 at 2:20 pm #2363307Tamarah
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.
October 4, 2022 at 2:38 pm #2363323Ying
StaffCustomer SupportDo 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.
October 5, 2022 at 9:26 am #2364325Tamarah
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.
October 5, 2022 at 9:54 am #2364363Tom
Lead DeveloperLead DeveloperHi 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!
October 14, 2022 at 8:59 am #2373702Tamarah
I will wait for GenerateBlocks to be updated. I’m not a fan of custom code ๐
-
AuthorPosts
- You must be logged in to reply to this topic.