- This topic has 5 replies, 2 voices, and was last updated 2 months ago by
David.
-
AuthorPosts
-
June 6, 2022 at 2:26 am #2244746
Marc
Hello, on a website I have posts with certain keywords. Now I want to show a post grid on all posts below the main content (Hook: generate_after_content), which displays teasers of posts that also have the respective keyword.
For the grid display of the teasers I use the plugin Spectra (fka “Ultimate Addons for Gutenberg”) from Brainstorm Force.
If I only include this grid directly below the post content in the post, everything works perfectly (https://prnt.sc/FnkZ73XtxvEu).
Now I tried to create a block under Elements that includes this grid. Then I set the rule that this block will be output on all posts that also have the same keyword. Technically this works fine, but unfortunately the grid is output unformatted or incorrectly formatted.
If I include the grid (as a test) both in the post and as an element block below the content, then the teasers are output in columns, but without further formatting.
If I include the grid in a post only via the element block, then the teasers are output completely unformatted (https://prnt.sc/cLzpxAu1EneW).
How do I make it so that I include the grid only once as a block element and that the teasers are displayed properly formatted?
Thank you very much for a tip!
Marc
June 6, 2022 at 3:59 am #2244818David
StaffCustomer SupportHi there,
i believe UAG parses the post content to see whether its blocks are present. But it won’t know of the Elements post type so won’t render its CSS. Another user had a similar issue – see reply with the filter required to tell the plugin what other post types to look for:
https://generatepress.com/forums/topic/issue-with-adding-ultimate-addons-for-gutenberg/#post-2020164
Alternatively we’re real close to releasing GB 1.5 which has its own Query Loop block, you may want to check that out:
https://generateblocks.com/generateblocks-1-5-dynamic-data-query-loops-image-blocks/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 6, 2022 at 5:44 am #2244911Marc
Hi David, thanks a lot for your tips. I have installed the filter, unfortunately the formatting still doesn’t work….
I have included this code in the functions.php of my child theme:
add_action( 'wp_enqueue_scripts', 'enqueue_scripts_by_post_id' ); function enqueue_scripts_by_post_id() { if ( 'post' == get_post_type() ) { $post_id = get_the_id(); // Create Instance. Pass the Post ID. $post_assets_instance = new UAGB_Post_Assets( $post_id ); // Enqueue the Assets. $post_assets_instance->enqueue_scripts(); } }
This has not changed the representation of the grid. Example: http://neu.wasserkuppe.net/wandern/ -> the Grid should be shown below the “Weitere Angebote” heading.
Do you have any idea what I did wrong?
Thanks again a lot and sunny greetings,
Marc
June 6, 2022 at 6:56 am #2244981David
StaffCustomer SupportYeah i am not sure how that function is meant to work.
Could you check with UAGB Support ?Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/June 6, 2022 at 6:58 am #2244983Marc
All right no problem, I’ll do that!
Thank you and have a nice day, Marc
June 6, 2022 at 8:28 am #2245220David
StaffCustomer SupportLet us know how you get on, or if they need any info from us.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.