WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Theme won't load new header? (3 posts)

  1. D C
    Member
    Posted 1 year ago #

    I've created a new theme (based off of Graphene), added a custom page template for the home page called homepageheader.php and uploaded it to the /themes folder. As you can see in the code below, I have the new page calling the new header file, with a new div for the navigation area. The rest of the site has a div in the main header.php file called nav. In the home page I changed that div to be called homenav which I'll style with the right elements.

    After all of this, it WILL NOT call the right header (I'm still seeing the wrong div elements on the home page even though the backside says the Home page is calling the new home page template from the dropdown menu). What am I doing wrong?

    It looks like this:

    New Home Page template file:

    <?php
    /*
    Template Name: New Home Page
    */
    
    get_header('homepageheader'); ?>
    
    	<?php
        /* Run the loop to output the posts.
         * If you want to overload this in a child theme then include a file
         * called loop-index.php and that will be used instead.
         */
         get_template_part('loop', 'index');
        ?>
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  2. paulwpxp
    Font hero
    Posted 1 year ago #

    get_header('homepageheader')

    will load this file

    header-homepageheader.php

    when that file doesn't exist, it'll load the default which is header.php

  3. D C
    Member
    Posted 1 year ago #

    I agree. I just found the answer elsewhere too. Which is really weird. Anyways, thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic