Group Admins

WordPress Troubleshooting and Support

Public Group active 1 year, 1 month ago ago

WordPress support from our community

WordPress Thesis – header on specific pages

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1255
    JH Saye
    Participant

    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.

    #2116
    D.K. Smith
    Participant

    What hook are you using with the header add_action?

    Which “remove_action” and associated hooks did you use?

    #2117
    JH Saye
    Participant

    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’);

    #2118
    D.K. Smith
    Participant

    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’

    #2119
    JH Saye
    Participant

    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;

    #2120
    D.K. Smith
    Participant

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

    function landing_page_header() {
    if(is_home()) {
    ?>

    #2121
    JH Saye
    Participant

    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))){
    ?>

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

    #2122
    D.K. Smith
    Participant

    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 “

    #2123
    JH Saye
    Participant

    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

    #2124
    D.K. Smith
    Participant

    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.

    #2125
    JH Saye
    Participant

    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() {
    ?>


    }

    function apply_custom_filters() {
    global $wp_query;
    $landing = get_post_meta($wp_query->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’);

#2126
D.K. Smith
Participant

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.

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.