Community Forums › Forums › Archived Forums › Design Tips and Tricks › Arranging Widget Area order
Tagged: Arranging Widget Area order
- This topic has 11 replies, 2 voices, and was last updated 8 years, 10 months ago by
PhilMurray.
-
AuthorPosts
-
August 9, 2014 at 11:43 am #117934
PhilMurray
Participanthi
I have added 2 new WIDGET AREAS both registered in my functions.php using 'genesis_after_header'
now what is happening is the PRIMARY NAV is getting pushed below these two new widgets.
so i assume the PRIMARY NAV must also be registered to 'genesis_after_header' in the core code?
so is there anyway I can order the widget areas so I can control which one appears second and third -- i want the PRIMARY NAV to be the first directly below the header
i noticed that in my functions.php there is no reference to the primary-nav or menus so I am assuming it is built into the core code -- i am building a new child theme based on the genesis sample child theme
thanks
Phil
August 9, 2014 at 12:37 pm #117946JanHoek
ParticipantUse number order like
add_action( 'genesis_after_header', 'your_widget', 3 ); add_action( 'genesis_after_header', 'your_widget', 6 ); add_action( 'genesis_after_header', 'your_widget', 8 );
also place them in order in your functions.php
Hi, my name is Jan Hoek. Sure, they all say I have a big head, but I like to think it’s way too small for all my ideas.
August 9, 2014 at 12:44 pm #117951PhilMurray
ParticipantThanks Jan --- i will try that
but do I need to add something in functions.php for the PRIMARY NAV also? is it registered as 'genesis_after_header' too in the core code? or will it always sit directly below the HEADER anyway even if other widgets are added to 'genesis_after_header' ?
also - i have styled the WIDGETS with background colours - but if the widget is not used [ie: has nothing in it] the backgroudn colour is still showing up on the site - how do I have the widgets NOT show up on the site unless they are being used?
thanks
Phil
August 9, 2014 at 12:49 pm #117954JanHoek
ParticipantI think the nav is ok. Wich code thit you use to register and show the widget-area?
Hi, my name is Jan Hoek. Sure, they all say I have a big head, but I like to think it’s way too small for all my ideas.
August 9, 2014 at 12:53 pm #117957PhilMurray
Participanthi Jan
this is one of them
thanks
Phil
/** Register Widget Area */
genesis_register_sidebar( array(
'id' => 'widget_before_content',
'name' => __( 'Homepage Below Menu' ),
'description' => __( 'This is below the bottom menu of the homepage.' ),
) );/** Add Slider Widget Area */
add_action( 'genesis_after_header', 'widget_before_content' , 3);
function widget_before_content() {
echo '<div class="widget_before_content">';
dynamic_sidebar( 'widget_before_content' );
echo '</div>';
}August 9, 2014 at 1:07 pm #117962JanHoek
ParticipantTry to register them this way
genesis_register_widget_area ( array( 'id' => 'widget_before_content', 'name' => __( 'Homepage Below Menu', 'childtheme' ), 'description' => __( 'This is below the bottom menu of the homepage.', 'childtheme' ), ) ); add_action( 'genesis_after_header', 'widget_before_content' , 3); function widget_before_content() { genesis_widget_area( 'widget_before_content', array( 'before' => '<div class="widget_before_content">', 'after' => '</div>', ) ); }
Hi, my name is Jan Hoek. Sure, they all say I have a big head, but I like to think it’s way too small for all my ideas.
August 9, 2014 at 1:39 pm #117972PhilMurray
ParticipantThanks a lot Jan - will do
where it says 'childtheme' - do i place the name of the childtheme in there or leave it as 'childtheme' ?
thanks
Phil
August 9, 2014 at 1:44 pm #117976JanHoek
ParticipantYour childthemes name
Hi, my name is Jan Hoek. Sure, they all say I have a big head, but I like to think it’s way too small for all my ideas.
August 9, 2014 at 3:45 pm #117995PhilMurray
ParticipantThis reply has been marked as private.August 9, 2014 at 3:50 pm #117996PhilMurray
Participanthi Jan
i tried that but the widget gets added above the PRIMARY NAV --- so looks like giving it an order ID is causing it to not sit below the NAV
So do I need to give the PRIMARY NAV an order ID of it's own?
if so - how?
thanks
Phil
August 9, 2014 at 3:58 pm #117997JanHoek
ParticipantNo. Use higher numbers in widgets-area. Like 12 and 15. The default of de nav is 10.
Hi, my name is Jan Hoek. Sure, they all say I have a big head, but I like to think it’s way too small for all my ideas.
August 9, 2014 at 4:08 pm #117998PhilMurray
Participantbrilliant Jan - thanks - worked a treat
cheers
Phil
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.