WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How can I use an alternative header.php (5 posts)

  1. eable
    Member
    Posted 7 years ago #

    Hello WordPress people!

    I want to use a different header.php for some pages. Both structure and content need to be slightly different, including the header image dimensions.

    Where do I look to start learning how to do this?

    For my next trick I want to learn how to swap out different sidebar content for different sections. Right now the header is the biggest issue.

    I'm using WP as part CMS, part blog.

  2. vlp
    Member
    Posted 7 years ago #

    Maybe look sometime to Docs/Codex and save yourself time...

    Anyway, this is the solution

    <?php include (TEMPLATEPATH . '/header2.php'); ?>

    for sidebar use the same principle

  3. eable
    Member
    Posted 7 years ago #

    I've tried searching the documentation for [alternative header] and TEMPLATEPATH and whatever else I could think of. Is there a specific place in the codex where I should look?

  4. eable
    Member
    Posted 7 years ago #

    Here's a little more info - hope this helps! I am already using an alternative header.php for my home page via something like <?php include (TEMPLATEPATH . '/header2.php'); ?>. I want to know how to do the same for some of the blog categories, and also some of the "static" wp pages. I don't know enough php to be able to find where to associate a "topicheader.php" with all the posts in a specific category, or a "page2header.php" with a specific page.

    Could someone please point me towards what would do this, or supply a search term that I could use to find it on my own? "Read the codex" or "read about templates" is not specific enough to stick to my 99% php-illiterate brain.

  5. eable
    Member
    Posted 7 years ago #

    Look what I found! I was Googling around for something else WordPress and found a link to this: different CSS for different categories.

    Color me (nerd) happy.

Topic Closed

This topic has been closed to new replies.

About this Topic