Skip to content

Instantly share code, notes, and snippets.

@adamharley
Created August 27, 2011 20:20
Show Gist options
  • Save adamharley/1175828 to your computer and use it in GitHub Desktop.
Save adamharley/1175828 to your computer and use it in GitHub Desktop.
Static content on WP posts page
<?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( ']]>', ']]&gt;', $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