Code Snippet > PHP

How to Get URL for Blog Page When Using Static Homepage

By default, a WordPress website displays the blog page, which is your most recent posts, on the front page. But many WordPress users want to have a static front page or splash page as the front page instead. Fortunately, WordPress allows you to select a different page for your home page

PHP

$posts_page_url is the url to blog page and $posts_page_title is the page title

<?php
$posts_page_id = get_option( 'page_for_posts');
$posts_page = get_page( $posts_page_id);
$posts_page_title = $posts_page->post_title;
$posts_page_url = get_page_uri($posts_page_id  );
?>


Source: http://www.dynamicwp.net/articles-and-tutorials/url-for-blog-page-when-using-static-omepage/



Show Some Love, Spread This Post!

0 comments

Leave a comment

Have something to say? Drop a comment! No HTML tags are allowed in the comment textfield.

Advertisement