We often have some posts that we would like to promote and keep at the first page of the blog. When you are using pagination, the sticky posts will be added to the standard posts, making the post count per page uneven.
If you want to keep your posts per page count consistent, there is a way to do that.
global $paged; $paged = 1; } // Set posts per page $posts_per_page = 8; // Get sticky posts $sticky = get_option( 'sticky_posts' );
// First page and has stickies 'post_type' => 'post', 'paged' => $paged, // Adjust posts per page by subtracting the amount of stickies ); }else{ 'post_type' => 'post', 'paged' => $paged, 'posts_per_page' => $posts_per_page, // making sure the 2nd page starts with the right post ); } // Do query query_posts($args);
BOOKING SOLUTIONS 202x This is my take on a subset of booking, appointment, PMS or… Read More
THE GOAL Create a system cron for WordPress, that is accessible and can be easily… Read More
2024, what's cooking? Slowly getting into the 2024 spirit. 3 projects coming to a close… Read More
Short look back at 2023 This has been a busy and interesting year. I am… Read More
Elementor Pro provides grid containers as an experimental feature. The options provided are limited, when… Read More
Archaeology Travel is an online travel guide for people who enjoy exploring the world’s pasts.… Read More