Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Query loop pagination problem when reloading page

  • Hi there

    I found the code snippet below in another topic, and have tried to add it, as I am having problems with the page going to the top of the page when using the pagination buttons.

    But I can’t get it to work. It worked when I used the old version of Query Loop.
    But with GB 2.0 Query it doesn’t work.

    Do you have a solution?

    add_filter(‘generateblocks_dynamic_url_output’, ‘custom_query_loop_pagination’, 10, 2);
    function custom_query_loop_pagination($url, $attributes) {
    if (!empty($url) && !empty($attributes[‘className’])) {
    if (strpos($attributes[‘className’], ‘pagination-button’) !== false) {
    $url = $url . ‘/#queryloop1’;
    }
    }
    return $url;
    }

    Thanks in advance/
    Knud

  • Hi there,

    With GB 2.0, you do not need any PHP filter.

    You just need to select the query block, and set Pagination type to instant.

  • wow, so easy 🙂
    What an improvement – you guys are amazing…

    Thank you so much for your fantastic work…

  • You are welcome   🙂

    Happy to hear that!

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