Site logo

Archived topic

Magazine Grid

16 replies · Started by JOAQUIM GALANTE on May 9, 2020

Viewing posts 16–17 of 17

Try this code. It works for me

add_filter( 'pre_get_posts', function( $query ) {
    if ( $query->is_home() && $query->is_main_query() ) {
        $offset = 2;
        $ppp = get_option('posts_per_page');

        if ( $query->is_paged ) {
            $page_offset = $offset + ( ($query->query_vars['paged']-1) * $ppp );
            $query->set('offset', $page_offset );
        } else {
            $query->set('offset',$offset);
        }
    } else {
        return $query;
    }
} );

Thank you Chaitanya for your interest in my problem. Solved thanks.

https://focusmsn.pt

This archived topic is closed to new replies.