• Resolved DebT

    (@debbiet)


    https://soulspringcoaching.com/
    I’ve been working on this all afternoon. I need to use a slightly different header for one page in this site, the blog page which is named “springboard”. My new headers are named header-blog.php and header-default.php (which will be for all the other pages). I’ve tried different approaches recommended in my searches, some from the WP Codex pages. At first I kept getting syntax errors and finally that’s not happening, but the code is not doing its thing. This is what I have at the top of index.php:

    <?php
    /**
     * Template: Index.php
     *
     * @package WPFramework
     * @subpackage Template
     */
    if ( is_page('springboard') ) :
      get_header('blog');
    else :
      get_header('default');
    endif;
    ?>

    That code is being ignored and the original header.php is being used by the blog page. I got these final instructions here https://codex.www.ads-software.com/Function_Reference/get_header under Multi headers.
    Please help!

Viewing 7 replies - 1 through 7 (of 7 total)
  • A Page won’t use index.php – it will use page.php. So you’re editing the wrong template file.

    Thread Starter DebT

    (@debbiet)

    Esmi, thanks. I added the php to the page.php file and it still doesn’t work. Is my code okay?

    Is this a static front page or another Page?

    Thread Starter DebT

    (@debbiet)

    Its not the front page, its another page set up for the blog.

    Ah! In that case, index.php was the right template to edit but you need to replace

    if ( is_page('springboard') ) :
      get_header('blog');
    else :
      get_header('default');
    endif;

    with

    get_header('blog');

    Thread Starter DebT

    (@debbiet)

    Aaaahhhh, I get it. The blog uses index.php and the other pages use page.php. That did the trick! Thank you SO MUCH, I never would have figured that out!

    No problem ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Two custom headers, can't get it to work.’ is closed to new replies.