30,
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
);
// Get current page and append to custom query parameters array
$custom_query_args[‘paged’] = get_query_var( ‘paged’ ) ? get_query_var( ‘paged’ ) : 1;
// Instantiate custom query
$custom_query = new WP_Query( $custom_query_args );
// Pagination fix
$temp_query = $wp_query;
$wp_query = NULL;
$wp_query = $custom_query;
// Output custom query loop
if ( $custom_query->have_posts() ) :
while ( $custom_query->have_posts() ) :
$custom_query->the_post();
// Loop output goes here
get_template_part( ‘template-parts/content’, ‘cards’);
endwhile;
endif;
// Reset postdata
wp_reset_postdata();
// Custom query loop pagination
previous_posts_link( ‘Página anterior’ );
next_posts_link( ‘Próxima página’, $custom_query->max_num_pages );
// Reset main query object
$wp_query = NULL;
$wp_query = $temp_query;
?>