[wp-trac] [WordPress Trac] #13840: $Paged Won't Set On Index When Static Page Is Set

WordPress Trac wp-trac at lists.automattic.com
Fri Jun 11 03:29:36 UTC 2010


#13840: $Paged Won't Set On Index When Static Page Is Set
--------------------------+-------------------------------------------------
 Reporter:  tehfab1       |       Owner:                                                   
     Type:  defect (bug)  |      Status:  new                                              
 Priority:  normal        |   Milestone:  3.0                                              
Component:  Query         |     Version:  3.0                                              
 Severity:  normal        |    Keywords:  paged, pagination, $paged, get_query_var('paged')
--------------------------+-------------------------------------------------

Comment(by tehfab1):

 I actually got rid of query_posts entirely. I apologize if I'm confusing
 you.

 I just want to get the paged variable.

 On a new wordpress 3 site, set a static page as the index of the site.

 Insert this code into the beginning of the page.php file to die and spill
 the $paged variable:

 <?php global $paged; die(var_dump($paged)); ?>

 Alternatively you could use this code as well, which I believe was the old
 standard compared to the code above:

 <?php $paged = get_query_var('paged'); die(var_dump($paged)); ?>

 Then visit: blog.com/?paged=2 Or setup permalinks and go to
 blog.com/page/2 . It will return nothing.

 Normally I'd take that variable and use it in query_posts along with other
 modifiers to the query so I could produce a more refined result. A basic
 use would be something like so: query_posts('paged='.$paged);

 That would grab me the posts in the loop for the current page we're on.
 But since it returns an empty string its hard to know what page we're on
 :). See? Or am I still not explaining it clear enough?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13840#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list