Posts Tagged ‘query_posts’

Define Your Own WordPress Loop Using WP_Query

78
responses
by
on
April 13th, 2008
in
HOW-TO, WordPress FAQs, WordPress Hack

We all know what the WordPress Loop is right? If not, there are many great tutorials around the web that explain the WordPress Loop. One of the easiest ways to navigate and manipulate the loop is to use the function called query_posts. Nathan Rice calls it a WordPress developers best friend. When you use query_posts, however, you risk the following: Potential to interfere with plugins which make use of the Loop. Potential to invalidate WordPress conditional tags. Having to deal with resetting, rewinding, offsetting… I say skip query_posts. In a way you’ll still be using it, but the better (and sometimes easier) technique is to instantiate your own WP_Query object and create your own loop. Creating Your Own Loop With WP_Query The first step is to instantiate your own variable using the WP_Query class. What we’ll be doing in this example is creating a common feature on blogs, which is […]

[Continue Reading...]



Obviously Powered by WordPress. © 2003-2013

css.php