Archived topic
Different headers with menu under picture
15 replies · Started by Edwin on November 9, 2016
Hi Tom
I need to build a website with the menu under the header in every page and a slider in the homepage above the menu (The home page with slider is not a problem), but I need in all other pages a different header image with the menu below.
Like this website:
http://www.berryfamilylaw.com.au/
What is the best way to this?
Thanks again for your help.
Edwin
Hi Edwin,
The Page Header add-on allows you to overwrite the logo on individual pages.
If you have a logo set, edit one of your pages and you should see a "Logo" tab in the Page Header meta box.
The only thing is the logo and the header image would need to be merged into one file.
Is there anything your theme can't do :-)
Thanks Tom
You're welcome :)
Hi Tom
I am showing another slider in a different page and all working fine, but menu is showing in the top above the slider.
I tried this and working:
Function.php:
function print_menu_shortcode($atts, $content = null) {
extract(shortcode_atts(array( 'name' => null, 'class' => null ), $atts));
return wp_nav_menu( array( 'menu' => $name, 'menu_class' => $class, 'echo' => false ) );
}
add_shortcode('menu', 'print_menu_shortcode');
Short-code inside the page with the menu styles:
[masterslider id="2"]
[menu name="menu" class="main-navigation ul"]
Would you able to give me the correct Menu styles?
Thanks
Edwin
Hmm, there might be an easier way.
This topic might help: https://generatepress.com/forums/topic/move-navigation-to-the-bottom-of-the-header/
You'll need to alter a couple of things if your navigation isn't set to float right - what's it set to?
Hi Tom
Do i put this in the function.php?
add_action( 'wp','tu_move_nav_inside_page_header' );
function tu_move_nav_inside_page_header()
{
$page_header_content = get_post_meta( get_the_ID(), '_meta-generate-page-header-content', true );
if ( '' !== $page_header_content ) {
remove_action( 'generate_after_header_content', 'generate_add_navigation_float_right', 5 );
add_action( 'generate_after_page_header', 'generate_add_navigation_float_right', 5 );
}
}
What do i change to make it work with that specific page?
http://visualdevelopment.com.au/croxford-partners/index.php/our-services/
Your code would be:
add_action( 'wp','tu_move_nav_inside_page_header' );
function tu_move_nav_inside_page_header()
{
$page_header_content = get_post_meta( get_the_ID(), '_meta-generate-page-header-content', true );
if ( '' !== $page_header_content ) {
remove_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 );
add_action( 'generate_after_page_header', 'generate_add_navigation_after_header', 5 );
}
}
Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/
It will detect if something is in your Page Header meta box and only apply then.
If you need to apply it to specific pages, you would need to use conditionals: https://codex.wordpress.org/Conditional_Tags
Hi Tom
after adding the code to custom.php file (Generate-simple-php) i am getting this error:
Fatal error: Call-time pass-by-reference has been removed; If you would like to pass argument by reference, modify the declaration of add_action(). in
Strange, try adding it using a plugin like this: https://en-ca.wordpress.org/plugins/code-snippets/
Hi Tom
Similar error:
The code snippet you are trying to save produced a fatal error on line 2:
Call-time pass-by-reference has been removed; If you would like to pass argument by reference, modify the declaration of add_action().
Hi Tom
Working now, but showing 2 menus now.
http://visualdevelopment.com.au/croxford-partners/index.php/our-services/
I'm not getting those errors, and the error is referencing something that doesn't exist in the code.
Make sure you're copying the code from this topic directly - not your email.
I just adjusted the code above to fix that: https://generatepress.com/forums/topic/different-headers-with-menu-under-picture/#post-246161
Thanks Tom. Working now.
You are the best!!