Where do I put the offset function?

            $args = array(
                'post_type' => 'post',
                'category_name' => 'category',
                'orderby' => 'date',
                'order' => 'DESC',
                'showposts' => 4);

            $wp_query = new WP_Query($args);
            if($wp_query->have_posts()) :
            while($wp_query->have_posts()) :
            $wp_query->the_post(); ?>

1 Answer 1


offset is one of the arguments that you can pass to WP_Query, so it belongs in the $args array:

$args = array(
    'post_type'     => 'post',
    'category_name' => 'category',
    'orderby'       => 'date',
    'order'         => 'DESC',
    'showposts'     => 4,
    'offset'        => 4,

PS: $wp_query is a reserved variable used by the main query. When creating your own WP_Query instance you should use a different variable name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.