• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Custom page templates and Headers

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Custom page templates and Headers

This topic is: resolved

Tagged: Custom header, page template

  • This topic has 5 replies, 2 voices, and was last updated 7 years, 1 month ago by Jeffreydotfong.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • February 14, 2016 at 9:44 pm #179052
    Jeffreydotfong
    Member

    Hi there,

    I am new to genesis but have played with wordpress twentytwelve before.

    I am trying to create a new page template and use a customised header-Landing.php specifically for my landing page. This is easy in twenty twelve because get_header is already in the page template. You just call the header.php file you want...

    In genesis, I have managed to remove the header and call a new header-landing.php, but I cannot seem to hook in 'get_header' at the right place. The customised header is being pulled outside the "site-container", as if the new header is being called - then gensis() function runs after it.

    How can effectively hook my customised header.php file into the genesis_header location hook?

    my page template code:

    <?php
    /*
    
    Template Name: Landing page template
    
     */
    
    //Removing the header http://wpsites.net/web-design/remove-header/
    remove_action( 'genesis_header', 'genesis_header_markup_open', 5 );
    remove_action( 'genesis_header', 'genesis_do_header' );
    remove_action( 'genesis_header', 'genesis_header_markup_close', 15 );
    
    //getting the custom header file
    add_action('genesis_header', get_header('Landing'));
    
    genesis();
    
    ?>
    February 15, 2016 at 3:18 am #179058
    Brad Dalton
    Participant

    You can use get_template_part in a custom function or echo the image in directly from your template using a custom function with the genesis_header hook.

    Or

    print the image using a custom function with hook and condtional tag from your functions file.


    Tutorials for StudioPress Themes.

    February 15, 2016 at 3:31 am #179059
    Jeffreydotfong
    Member

    Thanks Brad,

    I tried to use get_template_part ('Header','Landing') but just got the same result: the header ends up outside the site-container created by the genesis() function. It seems my actions aren't actually hooking into the right place:

    add_action('genesis_header', get_template_part('Header','Landing'));

    By creating a custom function, do you mean re-creating the genesis() function? Or just using echo to pull in a particular header image - I was hoping I could use the same header for different page templates or the different headers for the same template...

    February 15, 2016 at 3:40 am #179060
    Jeffreydotfong
    Member

    Ah actually, calling it in a custom function worked.

    add_action('genesis_header', 'loadlandingheader');
        function loadlandingheader() {
            get_template_part('Header','Landing');
    }
          

    How come I had to call it in a custom function to get it to sit inside the genesis() site-container?

    February 15, 2016 at 6:10 am #179064
    Brad Dalton
    Participant

    Thats how it works.


    Tutorials for StudioPress Themes.

    February 15, 2016 at 6:12 am #179065
    Jeffreydotfong
    Member

    Haha, great. I won't be adding anymore actions without a new function then!

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Custom page templates and Headers’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble