Created
August 27, 2011 20:20
-
-
Save adamharley/1175828 to your computer and use it in GitHub Desktop.
Static content on WP posts page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$this_page = $wp_query->get_queried_object(); // Get the current page | |
$this_page_id = $wp_query->get_queried_object_id(); // Get the current page ID | |
$posts_page_id = get_option('page_for_posts'); // Get the posts page ID | |
if ( $this_page_id == $posts_page_id ) { // If the current page has an ID and is the posts page | |
$updated = 'Last updated: ' . get_the_time( $this_page->post_modified ); // $this_page is a standard post object | |
$content = apply_filters( 'the_content', $this_page->post_content ); // Apply ‘the_content’ filters | |
$content = str_replace( ']]>', ']]>', $content ); | |
echo "Last updated: $updated<br />$content"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment