- This topic has 2 replies, 2 voices, and was last updated 7 years, 3 months ago by .
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
Using genesis_after_header hook, I can easily insert an element (e.g. an image slider) after the main nav.
But I'd like to place this slider between the site's logo and the main nav.
Any suggestion of how to achieve it?
Thank you so much.http://cotton.lampada.pt
It appears that you are using the Genesis Sample theme. The default location for the primary nav is the Genesis After Header area, which is loaded in the Genesis Framework in genesis/lib/structure/menu.php. This is where having a little understanding of the WordPress add_action function comes into play. The code for displaying the primary nav menu in the Genesis Framework is
add_action( 'genesis_after_header', 'genesis_do_nav' );.
Add action can receive a third parameter known as the priority. Priority defines the order in which actions are added to a specific hook. If no priority is specified, the default priority is 10. If you want something to appear before a specific action, you give it a lower number priority so it loads earlier. If you want it to appear after a specific action, you give it a higher numbered priority so it loads later.
You have tow choices. You can either create a new widget area and display it above the primary nav or you can create a function to display your slider and execute it above the primary nav. Whatever the case, you would add the new action with the following:
add_action( 'genesis_after_header', 'my_slider_code', 5 );
If you go the widget area route, this article should help get you started in the right direction. http://victorfont.com/add-widget-areas-to-news-pro-theme/
Victor, that's awesome! I thank you so much.
Priority seems to be the key.
However, I can't still get it to work.
I'm using Genesis Simple Hooks plugin and placing your piece of code on genesis_after_header area (selecting Execute PHP on this hook) and I'm using the code...
<?php add_action( 'genesis_after_header', 'putRevSlider( 'homeslider' );', 5 ); ?>
...and I must be missing something. The slider is not showing up...
Anyway, thank you so much for your time!
© 2023 WPEngine, Inc.