Carla Izumi Bamford - Just Another Creative Blogger

WordPress custom query with pagination

query_posts() for WordPress can be very handy when you want to control the contents. There is the posts_nav_link() links that works just fine, but the paginated function works great when you have quite a few posts to pull. So to start with the generic query code.

So there is the custom query and the main query loop in the start. And by default, WordPress uses the main query to determine pagination, and when you use a custom query, you create a new and entirely separate query.

And what happens is that even though you have paginated links, the link just loops to the same page. The solution was rather simple for this. Passing correct parameter for pages to the custom query like shown here:

At the end of the query, add wp_reset_query(); to make sure to reset the loop.

///Tested on Version 3.9.1

29/05/2014

Conditional tag for multiple pages

18/02/2011

Vino & Nino (Web Design)

Vino & Nino

Vino & Nino is a combination of personal blog and touring website. It has touring guide to Italy and other many countries. Two Harrods teddy bears “Vino & Nino” will introduce you around the globe. I was responsible for direction as well and had to come up with an idea to organize everything into one website. Using WordPress, it features a world wide map on the guiding page, and the top page design pulls all the contents from each sections, like a news feed.

(more…)

10/12/2010
Comments Off on Vino & Nino (Web Design)