- This topic has 9 replies, 4 voices, and was last updated 6 years, 6 months ago by Tom.
-
AuthorPosts
-
February 1, 2015 at 8:46 pm #71167Cassie Thomas
Is there a way I can place my secondary navigation bar below a featured image on each page?
I would like for each page to have a unique featured image or header/logo image. I have all the add ons. Is there a way I can do it with a combination of these?
I originally bought the “Hook” pack but realized you could not change the hook for each page…
I tried changing the header logo/image, but again can’t change it for each page.
Tried uploading a featured image on each page, and hiding the header image but then the navigation bar sits at the top of the website and not below the featured image.Any suggestions would be appreciated.
February 2, 2015 at 11:21 am #71391TomLead DeveloperLead DeveloperHi there,
You can try this PHP code which you can add using a plugin like this: https://wordpress.org/plugins/code-snippets/
add_action('after_setup_theme','generate_change_secondary_nav_position'); function generate_change_secondary_nav_position() { remove_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 7 ); add_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 30 ); }
In order for the above to work, your Secondary Nav position must be set to below the header.
Let me know π
February 2, 2015 at 12:36 pm #71413Cassie ThomasThanks Tom,
This worked great. Only thing I realized is that the main navigation is now at the top. Is there a way I can move both the main navigation and the sub navigation to go below the featured image.
Thanks
February 2, 2015 at 6:41 pm #71509TomLead DeveloperLead DeveloperThis code should work:
add_action('after_setup_theme','generate_change_secondary_nav_position'); function generate_change_secondary_nav_position() { remove_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 7 ); remove_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 ); add_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 30 ); add_action( 'generate_after_header', 'generate_add_navigation_after_header', 29 ); }
February 2, 2015 at 8:18 pm #71523Cassie ThomasBrilliant. Works like a charm. Thank you for your help.
February 2, 2015 at 10:07 pm #71530TomLead DeveloperLead DeveloperYou’re welcome π
December 7, 2016 at 11:03 am #252437SonyaHi. I’m using the secondary navigation in the header with a custom menu link to our forum, so I can’t use it above the content, so I’d like to find another way to have a featured content headline directly below (or possibly inside) the featured image and above the content. I found this code and it works in the “inside content container” hook box, except that the headline wraps over the content and bumps against the right sidebar, and I need it to stretch the length of the featured image above the content and the sidebar. Moving it to the “after header” hook puts it above the featured image. Any way to alter this code slightly to achieve the effect I need? (Or is there an easier way to create a featured content headline that spans the full width of the container above the sidebar? Sorry if I’m missing something obvious.) Thanks much again.
<?php wp_reset_query(); ?>
<?php if ( is_front_page() ) : ?><header style=”display:block;” class=”entry-header”>
<h1 class=”entry-title” itemprop=”headline”>Welcome to see the lazy brown fox jump over the moon with the cow and mrs. jones</h1>
</header><?php endif; ?>
December 7, 2016 at 7:59 pm #252544TomLead DeveloperLead DeveloperIf I’m understanding correctly, I think the
generate_before_main_content
hook is what you want.You can see how to use hooks (without GP Hooks) here: https://generatepress.com/knowledgebase/hook-list/
Let me know if you need more info π
March 23, 2018 at 12:44 pm #528419maxziebellI am using a child theme and trying to push the sidebar under the featured image too. I get a warning when I paste your code to my functions.php β¦ apart of Gutenberg and PHP7 I got nothing fancy going on.
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'generate_add_secondary_navigation_after_header' not found or invalid function name in /XXXXXXXXXXX/wp-includes/class-wp-hook.php on line 286
Best regards
March 23, 2018 at 8:55 pm #528807TomLead DeveloperLead DeveloperThis is a super old topic – it would be best if you could start a new one with more info on what you’re trying to do.
Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.