-
AuthorPosts
-
December 22, 2016 at 4:40 pm #727577
I would like to add a second menu to the footer socket. I copied over the footer.php file to my child theme and added this code at the bottom just before the end of the socket container:
<!– +++ place any extra stuff here to go after the socket line – adjust with css +++ –>
<footer class=’container_wrap socket_color’ id=’socket’ <?php avia_markup_helper(array(‘context’ => ‘footer’)); ?>>
<div class=’container’><?php
$avia_theme_location = ‘avia3’;
$avia_menu_class = $avia_theme_location . ‘-menu’;$args = array(
‘theme_location’=>$avia_theme_location,
‘menu_id’ =>$avia_menu_class,
‘container_class’ =>$avia_menu_class,
‘fallback_cb’ => ”,
‘depth’=>1,
‘echo’ => false,
‘walker’ => new avia_responsive_mega_menu(array(‘megamenu’=>’disabled’))
);$menu = wp_nav_menu($args);
if($menu){
echo “<nav class=’sub_menu_socket’ “.avia_markup_helper(array(‘context’ => ‘nav’, ‘echo’ => false)).”>”;
echo $menu;
echo “</nav>”;
}
?>
</div><!– ####### END SOCKET CONTAINER ####### –>
I need to be able to make this section access a different menu that I created named Socket 2 Menu. What do modify above to make it work?
Thanks in advance.
December 28, 2016 at 12:01 am #728313Hey amerisource,
Please add following code to Functions.php file of your child theme in Appearance > Editor
add_action( 'init', 'register_my_new_menu' ); function register_my_new_menu() { register_nav_menu('footer-second',__( 'Footer Second Menu' )); }
and then add edit your footer.php file and add following code before Socket closing div
<?php wp_nav_menu( array( 'theme_location' => 'footer-second', 'container_class' => 'my_extra_menu_class' ) ); ?>
Best regards,
Yigit- This reply was modified 7 years, 12 months ago by Yigit.
January 4, 2017 at 1:06 am #729226Not what I was looking for. It gives me this:
I am looking for a small menu under the first socket menu. I was able to replicate the socket menu below it, but can’t get it to change the links to my ‘Socket 2 Menu’. See here:
Thanks.
Nick
January 5, 2017 at 12:27 am #729684Hi Nick!
You forgot to check “Footer Second Menu” under Menu Settings in Appearance > Menus. I checked it and then removed your duplicate menu, added some custom CSS to bottom of your style.css file and flushed cache in total cache. Please review your website now
Best regards,
YigitJanuary 5, 2017 at 4:35 am #729708Thanks Yigit, but it still is not lining up correctly (see below). I tried changing the CSS, but there seems to be no effect, even if I comment it out. What am I doing wrong?
Thanks.
January 5, 2017 at 12:16 pm #729823Hi,
Please try adding this code to the Quick CSS section under Enfold > General Styling or to your child themes style.css file:
#socket:nth-child(2) .container { padding-top: 0; } .my_extra_menu_class { float: right; }
Best regards,
YigitJanuary 5, 2017 at 7:08 pm #730017Thank you – that’s great, it moved the menu to the right side as needed. How would I close the gap between the two menus? I tried using a negative number in the padding for the top in both the #socket and the .my_extra_class_menu, but neither one moved the menus closer together.
January 5, 2017 at 7:10 pm #730019Hi!
Please try adding following code to Quick CSS as well
#socket:nth-child(2) .container { margin-top: -10px; }
Regards,
YigitJanuary 6, 2017 at 10:20 pm #730541Great that worked with a few changes to the numbers – thanks so much.
For everyone wondering about how to do this, here’s the code that I placed in the style.css sheet (or you could place in the Quick CSS area):
/* == TO STYLE 2ND MENU IN FOOTER == */
.my_extra_menu_class li {
float: right;
display: block;
padding: 0 0 0 20px;
border-left-style: solid;
border-left-width: 1px;
line-height: 10px;
}#socket:nth-child(2) .container {
margin-top: -50px;
padding-bottom: 25px;
}Add this to the functions.php file:
add_action( ‘init’, ‘register_my_new_menu’ );
function register_my_new_menu() {
register_nav_menu(‘footer-second’,__( ‘Footer Second Menu’ ));
}I added the menu I wanted and checked secondary footer menu. No need to change anything in the footer.php file.
Thanks again Yigit.
January 7, 2017 at 7:46 am #730628Hi,
Great, glad you got it working and thanks for sharing your solution! Please let us know if you should need any further help on the topic.
Best regards,
RikardJanuary 11, 2017 at 2:55 am #731817Please close this topic.
-
AuthorPosts
- The topic ‘Add Second Menu to Footer Socket’ is closed to new replies.