GB query loop pagination top of page

[ad_1]

Hi there,

you need the code from here:
https://generatepress.com/forums/topic/query-loop-pagination-any-way-to-reload-in-place-if-a-query-loop-is-lower-down/#post-2364321

Thats a PHP snippet.
If you’re using a Child Theme on your site, then you can add it to its functions.php
If you’re not then install the Code Snippets plugin and create a new snippet to add the code.

Thank you, it does indeed work!

However, I found out if you add an other CSS class than the one from the php code, it won’t work. I just have to define a seperate class for previous and next, though.

Thank you again.

Try this PHP Snippet instead:

add_filter( 'generateblocks_dynamic_url_output', function( $url, $attributes ) {
if ( isset($block['attrs']['className']) && strpos($block['attrs']['className'], 'custom-next') !== false ) {
$url = $url . '#my-loop-id';
}

return $url;
}, 10, 2 );

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer