Community Forums › Forums › Archived Forums › Design Tips and Tricks › Change container order in custom footer
Tagged: Custom Footer, genesis_footer hook, php footer
- This topic has 4 replies, 3 voices, and was last updated 9 years ago by David Chu.
-
AuthorPosts
-
March 28, 2015 at 9:57 am #145942bayleaveMember
Hi everyone,
I added the following php-code in the functions.php to make a custom footer with two containers.
the first container is only text and this is the code:
//* Customize the entire footer remove_action( 'genesis_footer', 'genesis_do_footer' ); add_action( 'genesis_footer', 'sp_custom_footer' ); function sp_custom_footer() { ?> <p>© 2013 - 2015 Zuckersucht besiegen</p> <?php }
The second one is a footer-menu, which should be at the second place (at mobile phones the menu should appear under the text/container above). The problem is, when i insert the following code for the menu, the menu works fine, but appears at the first place. In both codes I use the genesis_footer-hook, but how can I choose/change the order of both container/areas?
Thanks a lot!
http://www.zuckersucht-besiegen.de/** Registering Footer Menu **/ register_nav_menus( array( 'footer_menu' => __('Footer Menu', 'genesis') ) ); //* Adding Footer Menu at footer /** * Echo the "Footer Navigation" menu. * * The preferred option for creating menus is the Custom Menus feature in WordPress. * * Either output can be filtered via <code>bt_do_footer_menu</code>. * * @uses genesis_markup() Contextual markup. * @uses genesis_html5() Check for HTML5 support. * @uses genesis_structural_wrap() Adds optional internal wrap divs. */ add_action( 'genesis_footer', 'bt_do_footer_menu', 7 ); function bt_do_footer_menu(){ //* If menu is assigned to theme location, output if ( has_nav_menu( 'footer_menu' ) ) { $args = array( 'theme_location' => 'footer_menu', 'container' => '', 'menu_class' => 'footer-menu-nav', 'depth' => 1, 'echo' => 0, ); $nav = wp_nav_menu( $args ); //* Do nothing if there is nothing to show if ( ! $nav ) return; $nav_markup_open = genesis_markup( array( 'html5' => '<nav %s>', 'xhtml' => '<div id="footer-menu">', 'context' => 'footer-menu', 'echo' => false, ) ); $nav_markup_open .= genesis_structural_wrap( 'menu-footer', 'open', 0 ); $nav_markup_close = genesis_structural_wrap( 'menu-footer', 'close', 0 ); $nav_markup_close .= genesis_html5() ? '</nav>' : '</div>'; $nav_output = $nav_markup_open . $nav . $nav_markup_close; echo apply_filters( 'bt_do_footer_menu', $nav_output, $nav, $args ); } }
March 28, 2015 at 10:06 am #145943ᴅᴀᴠɪᴅMemberIn the second bit of code you have
add_action( 'genesis_footer', 'bt_do_footer_menu', 7 );
The 7 is the priority number, the part that controls the order. The first bit of code you have missed this out which means it defaults to 10.
As 7 is before 10, this is why the menu comes first. Change the 7 to a number higher than 10 or change the first bit to include a number lower than 7 to change the order.
I love helping creative entrepreneurs build epic things with WP & Genesis.
March 28, 2015 at 10:17 am #145944David ChuParticipantHallo,
I didn't test your code, but it looks pretty good to me!I think all you need to do is raise the priority number for the second menu hook. I was able to get my 2nd call "last" by using 20, like so:
add_action( 'genesis_footer', 'bt_do_footer_menu', 20 );
If that doesn't do it, try using a higher number. Of course, it all depends on your theme set-up, whether you're using functions.php or a template, etc.
Mach's gut,
Dave
Dave Chu · Custom WordPress Developer – likes collaborating with Designers
March 28, 2015 at 11:27 am #145946bayleaveMember20 as a priority number didn't worked, but 11 did the job. Thank you very much!
March 28, 2015 at 12:38 pm #145949David ChuParticipantSounds good!
You're welcome.
Dave Chu · Custom WordPress Developer – likes collaborating with Designers
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.