WordPress.org

Ready to get started?Download WordPress

Forums

Get_Header("custom header") (4 posts)

  1. arimdallas
    Member
    Posted 2 years ago #

    Hello World!

    I am an amatuer web designer trying to make my own WP theme.

    I want to make a custom header template for my homepage. I have made a header_home.php file. In home.php, I have a simple line that says, <?php get_header_home; ?> I have also tried doing this <?php get_header ("header_home") ?>. Neither seems to call the new header template. Any suggestions on where I;ve misunderstood template files?

    Email is best for me if possible: [email moderated - this forum does not provide support via email]

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    when unsure how to use WordPress functions, read the Codex:

    http://codex.wordpress.org/Function_Reference/get_header

  3. arimdallas
    Member
    Posted 2 years ago #

    Hey Ari, this is yourself responding to your own question. Congratulations on finally figured out this Son of a "better left unsaid." So here is deal boys are girls and geeks of all ages. If you are "dumb" like I am and are trying to teach this stuff to yourself and only have this crazy mess of blogs through perhaps this will save you the 3 or so hours I have spent going insane.

    When using the get_header function, wp catergorizes your custom headers in special way. Let's say you want to create a header for your home page, a header for your blog page, and a header for your content pages. You could title them respectively:

    header-homepage.php

    header-blog.php

    header-content.php.

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

    get_header ( "homepage" ), get_header ( "blog" ). get_header ( "content").

    IN OTHER WORDS AND WHAT REALLY F-ED ME UP: YOU DON'T PUT THE HEADER PART AGAIN INSIDE THE " ". YOU ONLY PUT THE NAME LIKE, "blog", "content", "homepage", or whatever name you want. IN OTHER OTHER WORDS:

    NAME OF PHP HEADER: header-customheader.php

    HOW TO WRITE IT:

    YES: get_header ( "customheader" )

    NO: get_header ( "header-customheader" )

    NO: get_header ( "header-customheader.php" )

    NO: get_header ( "customheader.php" )

    NO: anything else

  4. sleeplessinDC
    Member
    Posted 1 year ago #

    THANK YOU arimdallas! That is what I needed to know. I've been trying all sorts of things because the Codex doesn't give any useful examples as to how to really specify the alternate header.

    It would be good if the Codex examples were actual how-to-code-it examples.

Topic Closed

This topic has been closed to new replies.

About this Topic