Load featured article once in a loop

I was able to find a solution to my own problem. For anyone needing to solve this in the future, WordPress offers a set of conditional statements for just able everything, include pagination. <?php get_header(); ?> <?php if ( ! $paged || $paged < 2 ){ ?> <?php locate_template( ‘featured-post.php’, true, false ); ?> <?php … Read more

Pagination in custom query not working [duplicate]

I believe the query var that you are retrieving should be paged and not page. See the codex and adjust your query to the following: $products_query = new WP_Query(array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 4, ‘paged’ => (get_query_var(‘paged’) ? get_query_var(‘paged’) : 1), )); However, if this is an archive for your product post type why … Read more

How to create an identical second loop for attachments?

You don’t need a second loop. Just save all the data you need later during the first loop. Sample code, not tested, just a hint: <ul class=”ei-slider-large”> <?php // Here we store the data. $second_loop = array(); // Main loop $main_query = new WP_Query( array( ‘category_name’ => ‘featured’, ‘posts_per_page’ => 3 ) ); if( $main_query->have_posts() … Read more