• Resolved masini2002

    (@masini2002)


    I have added a filter to show a series of entries that meet certain requirements. The query is correct but the pagination is not correct. Shows the total number of pages you would have without filtering. I’m stuck and don’t understand why it’s happening. Here is my code in case you can help me. Thank you so much.

    add_filter( 'generateblocks_query_loop_args', function( $query_args, $attributes ) {
        if (!is_admin() && !empty($attributes['className']) && strpos($attributes['className'], 'filtrar-por-practicas') !== false) {
    
            $query_args['meta_query'] = array(
                'relation' => 'AND',
                array(
                    'key'     => 'alum_imgcasoexitotrasera',
                    'compare' => '!=',
                    'value'   => '',
                ),
                array(
                    'key'     => 'alum_programa',
                    'value'   => '15815',
                    'compare' => 'LIKE'
                ),
            );
        }
    
        return $query_args;
    }, 10, 2 );
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support David

    (@diggeddy)

    Hi there,

    the filtrar-por-practicas class you added to the Query Loop. Try adding it to the Navigation Container block too. Then it will pass the query args to the pagination

    Thread Starter masini2002

    (@masini2002)

    I have added the class to each button and the pagination works perfectly. Thank you very much for the support!

    Plugin Support David

    (@diggeddy)

    Ah yes it has to be on the buttons ( not the container ). Glad to see you got it working!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Query Loop Block – Incorrect pagination custom filter code’ is closed to new replies.