Skip to content

Instantly share code, notes, and snippets.

@cyberwani
Forked from dnaber-de/page-for-posts-url.php
Created December 28, 2012 09:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cyberwani/4396239 to your computer and use it in GitHub Desktop.
Save cyberwani/4396239 to your computer and use it in GitHub Desktop.
<?php
/**
* gets the link to the article index
*
* @global $blog_id
* @return string
*/
function get_page_for_posts_url() {
global $blog_id;
$index_id = 0;
if ( is_multisite() )
$index_id = ( int ) get_blog_option( $blog_id, 'page_for_posts', 0 );
else
$index_id = ( int ) get_option( 'page_for_posts', 0 );
if ( 0 === $index_id )
return get_home_url( $blog_id );
return get_permalink( $index_id );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment