WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] trouble calling different header.php for home.php (3 posts)

  1. alexisfrsh
    Member
    Posted 1 year ago #

    I'm making a site that uses the same header.php for all pages except the blog/home.php. For this, I've created blog-header.php and am attempting to call it using the following:

    <?php if( is_page(15) ) {
    echo get_template_part( 'blog', 'header' );}
    else {
    echo get_header(); } ?>

    However, it doesn't seem to be working. Any ideas on why that may be?

    (Unfortunately, the site isn't live yet otherwise I'd provide a link.)

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Rename the file header-bog.php and use <?php get_header( 'blog');?>

  3. alexisfrsh
    Member
    Posted 1 year ago #

    What a life-saver, thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic