Get_header() only returning page formatting not site header

I am creating a custom php file to control a serial number search. My code is below;

if($found2){ 
    get_header();
        ?>
   <div class="x-container max width main">
    <div class="offset cf">
   <div class="<?php x_main_content_class(); ?>" role="main"></div>
   



<?php>  $query = new WP_Query(array(
                                'meta_value' => trim($name)));
if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
x_get_view( 'ethos', 'content', 'page' );
if (has_post_thumbnail()) {
    ?>
        <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?></a>
    <?php
}
?>
<h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<?php
//the_excerpt(); // or the_content(); for full post content
endwhile;endif;
get_sidebar();
get_footer();

  }

Currently, it results in a page that gives me the posts and the sidebar along with some formatting, but the actual header is missing from the page. See image:

If I remove the get_header() the page formatting goes away and I’m left with just the post title as a hyper link, plain text, and a basic html search bar.

The php file is located in my public_html file not my theme file. What do I need to do to get my header on this page?

Hi @avickery,

Thanks for writing in! Regretfully, this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself.

You might want to check the links below


https://developer.wordpress.org/themes/template-files-section/page-template-files/

Thank you for your understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.