• Resolved ordo273

    (@ordo273)


    Dear support,
    when using pagination on a Query Loop and changing the query by using “generateblocks_query_loop_args” the possible paginated pagenumbers do not update to the amount of search results. Since I would like to implement filters and have more result by default there would be empty pages at the end.

    How could I change the Query that results in how many pages are necessary for pagination, or should it already change the amount of pages dynamically?

    With kind regards

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support David

    (@diggeddy)

    Hi there,

    The class you add to Grid Block to pass the custom parameters to it; add that same class to the navigation buttons.

    Thread Starter ordo273

    (@ordo273)

    Hi David,
    thank you for the quick reply! I’ve added the calls to each button and the button container. But it still does not work unfortunately. Shortend code:

    add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
    global $my_query_filters;
    global $my_query_search;

    $meta_query = array(
    'relation' => 'AND',
    );
    $tax_query = array(
    'relation' => 'AND',
    );

    if ( ! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'booklist' ) !== false ) {
    [...] //do stuff

    $query_args['posts_per_page'] = 40;
    $query_args['tax_query'] = $tax_query;
    $query_args['meta_query'] = $meta_query;
    $query_args['post_status'] = 'publish';
    $query_args['meta_key'] = 'date';
    $query_args['orderby'] = 'meta_value';

    return $query_args;
    }, 10, 2 );
    Plugin Support ying

    (@yingscarlett)

    Can you remove the class from the button container?

    Thread Starter ordo273

    (@ordo273)

    Hey ying,
    thank you for the suggestion. Unfortunatly I already tried adding it to just the container; just the buttons and both with no success.

    Plugin Support David

    (@diggeddy)

    I notice the page is actually an archive, so is the Query Loop blocks parameters set to Inherit Query From Template ?

    Thread Starter ordo273

    (@ordo273)

    Hey David,

    You are correct that the linked page is an architect and the parameter is set son inherit the query from the template. But it is still changed later. The inheriting is set, that the pages are paginated with “/page/zx” and not as query parameters with the additional query-id string attachment.

    regards

    kelvin

    Plugin Support David

    (@diggeddy)

    If WP is handing the custom query for the archive , then In theory you should not need to use the generateblocks_query_loop_args hook to add those parameters. It should just Inherit the Query from Template.

    Thread Starter ordo273

    (@ordo273)

    Hey David,
    thank you very much. Indeed that setting was the problem!

    Plugin Support David

    (@diggeddy)

    Glad to hear you got it working!

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