WordPress Troubleshooting and Support
Public Group active 1 year, 5 months ago agoWordPress support from our community
WordPress Thesis – header on specific pages
Tagged: header on specific page, thesis
- This topic has 11 replies, 2 voices, and was last updated 11 years, 6 months ago by
D.K. Smith.
-
AuthorPosts
-
September 7, 2011 at 2:41 pm #1255
JH Saye
ParticipantI 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.
September 7, 2011 at 3:14 pm #2116D.K. Smith
ParticipantWhat hook are you using with the header add_action?
Which “remove_action” and associated hooks did you use?
September 7, 2011 at 5:31 pm #2117JH Saye
ParticipantHi 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’);September 7, 2011 at 5:48 pm #2118D.K. Smith
ParticipantComment 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’
September 7, 2011 at 6:02 pm #2119JH Saye
ParticipantGetting 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;September 7, 2011 at 6:34 pm #2120D.K. Smith
ParticipantOkay, let’s try adding a function for “landing_page_header”:
function landing_page_header() {
if(is_home()) {
?>
September 7, 2011 at 7:29 pm #2121JH Saye
ParticipantI 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’);September 7, 2011 at 8:37 pm #2122D.K. Smith
ParticipantThis 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 “
September 7, 2011 at 10:52 pm #2123JH Saye
ParticipantThank 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
September 7, 2011 at 11:38 pm #2124D.K. Smith
ParticipantYou’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.
September 8, 2011 at 12:13 am #2125JH Saye
ParticipantThanks 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’);September 8, 2011 at 1:21 am #2126D.K. Smith
ParticipantWOW! 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.
AuthorPostsViewing 12 posts - 1 through 12 (of 12 total)- You must be logged in to reply to this topic.
- ‘,
WordPress NYC Community is proudly powered by WordPress and BuddyPress