Pagination on custom post type on front-page.php

The root problem here is the call to query_posts: $args = array(‘post_type’ => array(‘posts’, ‘affiliate-products’)); query_posts($args); At no point do you tell it which page to fetch, so it always fetches the first page, aka the default. You could add this, but fundamentally, the entire approach is incorrect, and has many other problems you might … Read more

Continue or break the while loop

‘break’ is the right keyword… code structure below, no custom query needed if used in a standard template. <?php $posts_per_first_section = 6; //how many posts you want to show in the first section// if ( have_posts() ) : ?> <!– opening html for first loop –> <?php /* Start the Loop */ while ( have_posts() … Read more

How to display first post

Calling the_post() is what advances the internal current_post counter that have_posts() checks the value of within the loop. With this in mind, you can call the_post() once outside the loop and use any template tags you wish, then run the loop as normal and it will pick up and continue from the second post. the_post(); … Read more

How to add a lightbox to class mix?

If you only need to add a “lightbox” class to each element you just need to change this : echo'<div class=”mix ‘.$item_classes.'”>’.get_the_post_thumbnail().'</div>’; to this : echo'<div class=”mix lightbox ‘.$item_classes.'”>’.the_post_thumbnail(‘thumbnail’, array(‘class’ => ‘lightbox’)) .'</div>’; And if you want to add the full size image to be opened, try this : $featured_img_url = get_the_post_thumbnail_url(get_the_ID(),’full’); echo'<div class=”mix lightbox … Read more