I want to include the content of an existing page in the header.php file? What's the easiest way to do this? I am guessing that there is a way to load an existing page via a php call, however I am not sure of the correct syntax.
Thanks, in advance.
You could instantiate a new query:
$query = new WP_Query( 'page_id=7' );
After doing so, you make a loop to display the query's content.
<?php if ( $query->have_posts() ) : ?>
<!-- the loop -->
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php endwhile; ?>
<!-- end of the loop -->
<?php wp_reset_postdata(); // Important, so this loop does not affect the global post object afterwards ?>
<?php endif; ?>
This is based on WP's official codex: https://codex.wordpress.org/Class_Reference/WP_Query