[wp-trac] [WordPress Trac] #25423: Add a template link template function for getting a permalink to the blog index

WordPress Trac noreply at wordpress.org
Thu Sep 26 19:09:05 UTC 2013


#25423: Add a template link template function for getting a permalink to the blog
index
-------------------------+------------------------------
 Reporter:  ericlewis    |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Template     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+------------------------------

Comment (by ericlewis):

 I'll suggest get_blog_url() to match the general naming conventions of
 other link template functions ( e.g. get_admin_url() ).

 I'm sure there are a multitude of setups that I am unfamiliar with that go
 back to the 1.0 days we'll have to cover for backwards compatibility, so
 excuse the naive in my starter-code suggestion:

 {{{
 function get_blog_url() {
         // If a page is set to show the blog index, return that.
         if ( get_option( 'page_for_posts' ) )
                 return get_permalink( get_option( 'page_for_posts' ) );

         // If there is a page on front, there is no blog index.
         if ( 'posts' === get_option( 'show_on_front' ) )
                 return site_url();

         // Otherwise, there is no blog index.
         return false;
 }
 }}}

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


More information about the wp-trac mailing list