0

My template works fine, however, its using my main header file, even though I have changed it to point to sub-header.php

<?php /* Template Name: Sub Page */ 
get_header('sub-header'); ?>
0

You are following a wrong format to call sub header file.

Here is how we have to call sub header files:

<?php get_header('subexample'); ?>

Here is how you have to name the sub header file:

header-subexample.php

Hope this helps!

1

You only need to pass the slug to get_header() function; for example, to call header-sample.php:

<?php get_header( 'sample' ); ?>
0

You need to change you header file name

From sub-header.php to header-sub.php and call it by using following code:

<?php /* Template Name: Sub Page */ 
get_header('sub'); ?>

For more detail see here.

0

When using the get_header() function, all you need to do is name the file as like

header-sub-header.php or header-content.php.

When you are using the get_header() function you would call the your custom headers like this:

get_header( "sub-header" )
//OR
get_header ( "content" )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.