Site logo

[Resolved] An issue with the load more button

Home Forums Support [Resolved] An issue with the load more button

Home Forums Support An issue with the load more button

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2481585
    Leo

    Hi!

    I sent a ticket to GenerateBlocks a few days ago and never got a response, so I’m asking for help here.

    I’ve remade my blog page because I used the old WP Show Posts plugin and wanted to update to the new Query Loop block.

    Now, if you click the button to load more posts (at the bottom of the blog page), you get duplicated posts (already displayed), and new entries are loaded not right after the button but in the middle of the page.

    (By the way, I found this topic dated a few months ago on the GenerateBlocks forum, pointing to a similar problem.)

    I’d be very grateful if you could help me to solve the problem. Thanks.

    #2481982
    David
    Staff
    Customer Support

    Hi there,

    sorry for late response, ill take a look into what happened on the GB Support forum.

    How has the additional post lists been added to the blog page ?

    #2484376
    Leo

    Hi David,

    I created an element (hook type) and hooked it to “before_main_content.” This element is located on the default blog page and has three query loop blocks (displaying three different kinds of posts).

    Since this is the WP default blog page, after the query loop blocks, it automatically displays an autogenerated list of posts and then the load more button that originates the problem.

    I don’t need this autogenerated list, but I don’t know how to get rid of it (and the load more button). If you can tell me how to prevent displaying the WP autogenerated list of posts and its default button, it would also be OK.

    Thanks! 🙂

    #2484511
    David
    Staff
    Customer Support

    Can you try adding this PHP Snippet to your site:

    add_filter( 'post_class', function( $classes ) {
    	$infinite_scroll_item_index = array_search( 'infinite-scroll-item', $classes );
    
    	if ( in_array( 'gb-query-loop-item', $classes ) && $infinite_scroll_item_index !== false ) {
    		unset( $classes[ $infinite_scroll_item_index ] );
    	}
    
    	return $classes;
    } );
    #2486439
    Leo

    It’s perfect now. Thank you very much, David! 🙂

    #2486770
    David
    Staff
    Customer Support

    You’re welcome.

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