[wp-trac] [WordPress Trac] #2834: Cannot conditionalize previous_posts_link() or next_posts_link()

WordPress Trac wp-trac at lists.automattic.com
Fri May 21 22:03:36 UTC 2010


#2834: Cannot conditionalize previous_posts_link() or next_posts_link()
---------------------------+------------------------------------------------
 Reporter:  paulschreiber  |        Owner:  pishmishy
     Type:  enhancement    |       Status:  reopened 
 Priority:  normal         |    Milestone:           
Component:  Template       |      Version:  3.0      
 Severity:  normal         |   Resolution:           
 Keywords:                 |  
---------------------------+------------------------------------------------
Changes (by jimisaacs):

  * status:  closed => reopened
  * version:  2.2.3 => 3.0
  * resolution:  wontfix =>


Comment:

 I think I understand what paulschreiber meant.

 adjacent_post_link is one of the only functions in link-template without a
 return equivalent.

 I have ran into this problem in dozens of sites and themes I have
 developed. Most of the time I need to wrap the next and prev navigation in
 an overall element to be able to style it more appropriately. In order to
 do this correctly, I need to see if there are actually links that can and
 will print. Whether it iss one, the other, or both.

 If so, print the navigation, if not, don't print the navigation.

 All this would be solved by adding get_adjacent_post_link(). Then calling
 that from adjacent_post_link.

 Without this function I have to write a duplicate function over and over
 and over, changing one thing in one line.

 'echo' to 'return'

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


More information about the wp-trac mailing list