Difference between these query methods?
-
I found this code format when looking to do some custom query work, before I did any research.
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("paged=$paged&posts_per_page=-1");
I have no idea what the top bit of code is doing, and while I get the posts per page bit, I don’t get what “paged=$paged” is for. Can anyone explain to me what this code is doing?
I’ve now been using arrays for query parameter, like so:
$args = array( 'category_name' => '!featured', 'offset' => 2, 'posts_per_page' => 2, ); query_posts($args);
The latter seems to be the cleaner, more proper approach, but I’m not sure. If someone could tell me what that original code does exactly (specifically the paged bit), and if the array method is a more correct method, that would be great.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Difference between these query methods?’ is closed to new replies.