[wp-trac] [WordPress Trac] #6139: is_year() returns false on year archive pages under /blog (or any non-root blog locale)

WordPress Trac wp-trac at lists.automattic.com
Sun Mar 9 18:43:54 GMT 2008


#6139: is_year() returns false on year archive pages under /blog (or any non-root
blog locale)
-------------------------+--------------------------------------------------
 Reporter:  forgetcolor  |       Owner:  anonymous
     Type:  defect       |      Status:  new      
 Priority:  high         |   Milestone:  2.3.4    
Component:  General      |     Version:           
 Severity:  normal       |    Keywords:           
-------------------------+--------------------------------------------------
 '''Summary:'''

 is_year() should return true on a year archive page, such as
 domain.com/2008.  if you change the custom permalink structure and static
 front page setup so that your blog lives under /blog, then is_year() will
 no longer return true for year archives, such as domain.com/blog/2008.

 '''To reproduce the bug:'''

 1. setup a new 2.3.3 install with the default theme[[BR]]
 2. write a blank new post and publish[[BR]]
 3. visit the site and go to a year/month archive, such as
 domain.com/2008/03.  the header of the page will appropriately read
 'Archive for March, 2008'.  [[BR]]
 4. visit the site and go to a year archive, such as domain.com/2008.  the
 header of the page will appropriately read 'Archive for 2008.'[[BR]]

 '''The above works as it should.  Now, follow these additional steps to
 reproduce the bug:'''

 5. create a new Page called 'blog' with slug 'blog' (default
 template)[[BR]]
 6. create a new Page called 'home' with slug 'home' (default
 template)[[BR]]
 7. go to options->reading, set the front page to 'a static page' and
 select 'home' as the front page and 'blog' as the posts page[[BR]]
 8. go to options->permalinks, select custom, and set it to
 /blog/%year%/%monthnum%/%postname%/[[BR]]
 9. visit the site and go to a year/month archive, such as
 domain.com/blog/2008/03.  the header of the page will (appropriately) read
 'Archive for March, 2008.'  this comes from a conditional in the theme
 using is_month(), which returns true.  now visit domain.com/blog/2008.
 this should trigger the is_year() conditional in the same file so that it
 prints 'Archive for 2008', but it does not.  this is because is_year() is
 returning false now that the blog lives under /blog.[[BR]]

 It appears that the event that triggers this is adding /blog to the front
 of the custom permalink structure.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6139>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list