Site logo

Archived topic

Bug: Double content using content templates in elements

5 replies · Started by Anders Nielsen on May 10, 2022

Viewing posts 1–6 of 6

Hi there

I get "double content" using content templates in elements.

Could this be a bug in generateblocks aplha?

Link in private section.

Hi there,

have you added a GenerateBlocks Query Block inside a Block Element Content Template ?

Hi there.

No I don't think so.

Add'ed a little video with the setup in the private section.

Content Templates are output inside the WordPress loop, so when you visit an archive page that template will be ouput for each and every post that would normally be displayed there.

What you need to do is to replace the Loop and hook in your own template.
Today that will need code:

1. Add this PHP snippet to your site:

add_filter( 'generate_has_default_loop', function( $show ) {
    if ( is_category() ) {
        $show = false;
    }
    return $show;
} );

2. Change your Block Element Content Template to a Block Element - Hook and use the before_main_content hook.

ok, thanks.. Would be nice if the content templates could do some of the snippet work :)

Its in progress.
First we added the generate_has_default_loop filter to the theme, so the loop could be disabled.
We then developed the GenerateBlocks Query Loop so you can build your own post loops in GB 1.5 Alpha

Once thats live we can then update GP Premium so you can switch out your loop without code :)

Glad to be of help

This archived topic is closed to new replies.