Wordpress Thesis – header on specific pages (12 posts)

Topic tags: header on specific page, thesis
  • Profile picture of JH Saye JH Saye said 1 year, 8 months ago:

    I have been attempting to have a specific header on specific page. I followed instructions for creating a landing page found on the DIY Themes site and have been able to get the layout I want. However I am not able to get the header to show. In custom_function.php I created a custom body class, registered sidebars for the landing page and applied custom filters to remove defaults and used “add_action” to show the landing page sidebars, but the “add_action” code for the header does not have any effect.

    I have been working on this for almost a week, any suggestion would be appreciated.

    Thanks for reading.

  • Profile picture of D.K. Smith D.K. Smith said 1 year, 8 months ago:

    What hook are you using with the header add_action?

    Which “remove_action” and associated hooks did you use?

  • Profile picture of JH Saye JH Saye said 1 year, 8 months ago:

    Hi D.K.

    // remove unwanted sections
    add_filter(‘thesis_show_header’, ‘custom_remove_defaults’);
    add_filter(‘thesis_show_sidebars’, ‘custom_remove_defaults’);

    // add new sidebars
    add_action(‘thesis_hook_after_content’,'landing_page_sidebar’);

    // add new header
    add_action(‘thesis_hook_header’,'landing_page_header’);

  • Profile picture of D.K. Smith D.K. Smith said 1 year, 8 months ago:

    Comment out:

    // add_filter(‘thesis_show_header’, ‘custom_remove_defaults’);

    Try adding these:

    remove_action(‘thesis_hook_header’, ‘thesis_default_header’);
    add_action(‘thesis_hook_header’, ‘landing_page_header’);

    If that doesn’t work, post the function you’re using for ‘custom_remove_defaults’

  • Profile picture of JH Saye JH Saye said 1 year, 8 months ago:

    Getting closer, I now have a header but it’s the website header, not the landing page header. Since I don’t know how to write code, much of my functions are from reading instructions, copying and pasting. To remove defaults, I have:

    function custom_remove_defaults($content) {
    return false;

  • Profile picture of D.K. Smith D.K. Smith said 1 year, 8 months ago:

    Okay, let’s try adding a function for “landing_page_header”:

    function landing_page_header() {
    if(is_home()) {
    ?>
    <img src="/custom/images/LANDING-PAGE-HEADER.NAME” width=”WIDTH” height=”WIDTH” alt=”" />

    <?php
    }
    remove_action(‘thesis_hook_header’, ‘thesis_default_header’);
    add_action(‘thesis_hook_header’, ‘landing_page_header’);

    Upload your header image to "/custom/images/" folder and replace CAPS above with your specific info.

    If the landing page is not your home page substitute code below for " if(is_home())":

    if (is_page (array( ID-NUMBER-OF-PAGE-HERE )))

  • Profile picture of JH Saye JH Saye said 1 year, 8 months ago:

    I had a blank white page, even WP-admin wouldn’t load. I corrected the problem by deleting the function in c-panel.

    Here is what I had added to the end of my custom_function.php file.

    function landing_page_header() {
    if(is_page(array(949))){
    ?>

    <?php
    }
    remove_action(‘thesis_hook_header’, ‘thesis_default_header’);
    add_action(‘thesis_hook_header’, ‘landing_page_header’);

  • Profile picture of D.K. Smith D.K. Smith said 1 year, 8 months ago:

    This is hard to do without seeing all. Kind of like directing a surgery over the phone.

    A blank screen is usually just a tag error in the PHP code.

    Remove “<?php }" from the code above and try again.

    BTW, much better to do work like this via FTP than the WP admin (IMHO).

  • Profile picture of JH Saye JH Saye said 1 year, 8 months ago:

    Thank D.K.

    And a great surgeon you are, too bad my php skill level is equivalent to high school biology. :)

    I’ve been playing with the code by editing the file in cpanel, makes it easier to recover from the white screen.

    I tried removing the <!–?php from the code, no luck. Tried using the full url for the landing page header, no luck.

    Since I do now have a header on the page, even if it is the wrong header I think I am closer to the solution. Just need it to call the correct file for the header.

    Thanks again for your help.

  • Profile picture of D.K. Smith D.K. Smith said 1 year, 8 months ago:

    You’re welcome. But since the patient isn’t dead yet, send me your URL and custom_functions as a text file (save as custom_functions.txt). I’ll take a first-hand look and if need be, plug it into one of our test sites and tweak it for you.

  • Profile picture of JH Saye JH Saye said 1 year, 8 months ago:

    Thanks D.K.

    The url is thedigitalhealthclub.com; trying to put a different header on this page http://thedigitalhealthclub.com/?page_id=949.

    No clue on how to attach a file here so I’ve pasted the landing page custom_functions test below.

    /*LANDING PAGE*/

    function custom_body_classes($classes) {
    $classes[] = “landing-page”;

    return $classes;
    }

    function custom_remove_defaults($content) {
    return false;
    }

    register_sidebars(2,
    array(
    ‘name’ => ‘Landing Page %d’,
    ‘id’ => ‘landing-page-$i’,
    ‘before_widget’ => ”,
    ‘after_widget’ => ”,
    ‘before_title’ => ”,
    ‘after_title’ => ”
    )
    );

    function landing_page_sidebar() {
    ?>


    post->ID, ‘landing-page’, true);
    if ($landing) {
    // remove unwanted sections
    // add_filter(‘thesis_show_header’, ‘custom_remove_defaults’);
    add_filter(‘thesis_show_sidebars’, ‘custom_remove_defaults’);
    add_filter(‘thesis_show_footer’, ‘custom_remove_defaults’);
    //add custom body class
    add_filter(‘thesis_body_classes’,'custom_body_classes’);
    //add new header
    add_action(‘thesis_hook_header’,'landing_page_header’);
    // add new sidebars
    add_action(‘thesis_hook_after_content’,'landing_page_sidebar’);
    remove_action(‘thesis_hook_header’, ‘thesis_default_header’);
    add_action(‘thesis_hook_header’, ‘landing_page_header’);
    }
    }
    add_action(‘template_redirect’,'apply_custom_filters’);
  • Profile picture of D.K. Smith D.K. Smith said 1 year, 8 months ago:

    WOW! I think there’s a much simpler way to accomplish everything you wish to do. Sending you an email now so we don’t bore folks to death.

    And yes everyone, we’ll come back and post the solution.