Try using:
<?php
// Determine context
$page_id = ( 'page' == get_option( 'show_on_front' ) ? get_option( 'page_for_posts' ) : get_the_ID );
// Echo post meta for $page_id
echo get_post_meta( $page_id, 'Page Description', true );
?>
What’s happening:
- You’re using a static page as front page, and a static page to display the blog posts index
- You’ve added your post custom metadata (i.e. custom field) to a Static Page, and then assigned that page to display the blog posts index
- In that scenario, WordPress uses either
home.php
orindex.php
(in that order, per the Template Hierarchy), to render the blog posts index. WordPress will never usepage.php
or any custom page template to display the blog posts index. - In either
home.php
orindex.php
, WordPress makes no reference to ID of the page assigned to display the blog posts index. - Thus, if you want to reference data associated with that page ID, you need to query it directly
- Enter
get_option( 'page_for_posts' )
, which returns the ID of the page assigned to display the blog posts index.
Note: since you’ve put this code in your header.php
, it’s going to output in every template file; so you’ll want to add some fail-safes.
Edit
Example fail-safes:
-
To display just on the blog posts index, wrap the whole thing in:
if ( is_home() ) {}
-
To display on static pages and the blog posts index, wrap the whole thing in
if ( is_home() || is_page() ) {}