#25423 closed enhancement (duplicate)
Add a template link template function for getting a permalink to the blog index
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Template | Keywords: | |
| Focuses: | Cc: |
Description
There is currently no link template function to get the blog index permalink easily, although we have a plurality for more granular blog archives (get_day_link(), get_search_link(), etc).
Change History (3)
Note: See
TracTickets for help on using
tickets.
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; }