Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter j.biddy

    (@jbiddy)

    So after a lot of searching through the WP Codex here is the solution I was able to come up with.

    My first step was to log into my web server via FTP and download the template file I was using, in my case sidebar-page.php. Then I opened the file in a text editor (Bluefish) and changed the first part from this:

    <?php
    /**
    * Template Name: Sidebar Template
    * Description: A Page Template that adds a sidebar to pages
    *
    * @package WordPress
    * @subpackage Twenty_Eleven
    * @since Twenty Eleven 1.0
    */

    get_header(); ?>

    To this:

    <?php
    /**
    * Template Name: Sidebar Test Template
    * Description: A Page Template that adds a sidebar to pages
    *
    * @package WordPress
    * @subpackage Twenty_Eleven
    * @since Twenty Eleven 1.0
    */

    if ( is_page(‘whatever_page_you_want’)) :
    get_header( ‘whatever_page_you_want’ );
    else :
    get_header();
    endif;
    ?>

    whatever_page_you_want can be a page id eg 158, it can be an about page eg about.php. The next step is to create the header file that you want the get_header(); function to call. So, create the file header-whatever_page_you_want.php. Alter the layout of the header as you desire and upload the files to your child directory. To add more pages to have separate headers for:

    if ( is_page(‘whatever_page_you_want’)) :
    get_header( ‘whatever_page_you_want’ );
    elseif ( is_404() ) :
    get_header( ‘404’ );

    else :
    get_header();
    endif;
    ?>

    This worked for me and hopefully is considered best practices.

    Thread Starter j.biddy

    (@jbiddy)

    @esmi I am operating a child theme, thanks for the reminder though. Us WP noobs have to be reminded about the child theme, super important!

    Thanks again, everyone.

    Thread Starter j.biddy

    (@jbiddy)

    @s3mw I had considered just hard coding it into the header.php page as you suggest but thought I would ask first as that didn’t seem like preferred WP practice on first consideration.

    Thanks for the info, all.

Viewing 3 replies - 1 through 3 (of 3 total)