Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding Additional Nav-Menu in Generate Pro Child theme Footer Area
- This topic has 2 replies, 2 voices, and was last updated 7 years, 7 months ago by TonySan1.
-
AuthorPosts
-
February 13, 2017 at 7:08 pm #201094TonySan1Member
Hello StudioPress Community, I hope you are all doing well this day.
Oh Boy do I need your help! I am trying to add an additional NavBar-Menu to the Generate Pro child theme footer area. I have added the php code to the bottom of my functions php file. The problem is it's not working, I still only see the 2 default nav- menus that come with this theme. It would really be a help to me if someone with coding experience could take a look at my code edits below and give me some advice as to why this code is not creating an additional nav edit field in my Menus area. Any help and time you give will be greatly appreciated. 🙂This is the code I added to the bottom of my default functions php:
<?php // Remove the line above when adding to functions.php // Add theme support for new menu // Add New Footer Menu; Keep Primary and Secondary Menus add_theme_support ( 'genesis-menus' , array ( 'primary' => __( 'Primary Navigation Menu', 'genesis' ), 'secondary' => __( 'Secondary Navigation Menu', 'genesis' ), 'footer' => __( 'Footer Navigation Menu', 'genesis' ) ) ); // Add footer menu just above footer widget area add_action( 'genesis_before_footer', 'amethyst_footer_menu', 9 ); function amethyst_footer_menu() { genesis_nav_menu( array( 'theme_location' => 'footer', 'container' => 'div', 'container_class' => 'wrap', 'menu_class' => 'menu genesis-nav-menu menu-footer', 'depth' => 1 ) ); } // Add attributes to markup // http://www.rfmeier.net/using-genesis_markup-with-html5-in-genesis-2-0/ add_filter( 'genesis_attr_nav-footer', 'custom_add_nav_footer_attr' ); function custom_add_nav_footer_attr( $attributes ){ // add role $attributes['role'] = 'navigation'; // add itemscope $attributes['itemscope'] = 'itemscope'; // add the site navigation schema $attributes['itemtype'] = 'http://schema.org/SiteNavigationElement'; // return the attributes return $attributes; }
Here is the code in it's entierty:
http://diyinternetmarketer.com<?php //* Start the engine include_once( get_template_directory() . '/lib/init.php' ); //* Setup Theme include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' ); //* Set Localization (do not remove) load_child_theme_textdomain( 'generate', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'generate' ) ); //* Child theme (do not remove) define( 'CHILD_THEME_NAME', __( 'Generate Pro Theme', 'generate' ) ); define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/generate/' ); define( 'CHILD_THEME_VERSION', '2.1.1' ); //* Add HTML5 markup structure add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); //* Add viewport meta tag for mobile browsers add_theme_support( 'genesis-responsive-viewport' ); //* Enqueue Scripts add_action( 'wp_enqueue_scripts', 'generate_load_scripts' ); function generate_load_scripts() { wp_enqueue_script( 'generate-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' ); wp_enqueue_style( 'dashicons' ); wp_enqueue_style( 'google-font', '//fonts.googleapis.com/css?family=Source+Sans+Pro:300,600', array(), CHILD_THEME_VERSION ); } //* Add new image sizes add_image_size( 'blog', 700, 300, TRUE ); //* Add support for custom header add_theme_support( 'custom-header', array( 'width' => 360, 'height' => 140, 'header-selector' => '.site-title a', 'header-text' => false, ) ); //* Add support for custom background add_theme_support( 'custom-background' ); //* Add support for additional color style options add_theme_support( 'genesis-style-selector', array( 'generate-pro-blue' => __( 'Generate Pro Blue', 'generate' ), 'generate-pro-green' => __( 'Generate Pro Green', 'generate' ), 'generate-pro-orange' => __( 'Generate Pro Orange', 'generate' ), ) ); //* Unregister layout settings genesis_unregister_layout( 'content-sidebar-sidebar' ); genesis_unregister_layout( 'sidebar-content-sidebar' ); genesis_unregister_layout( 'sidebar-sidebar-content' ); //* Unregister secondary sidebar unregister_sidebar( 'sidebar-alt' ); //* Remove unused sections from Genesis Customizer add_action( 'customize_register', 'generate_customize_register', 16 ); function generate_customize_register( $wp_customize ) { $wp_customize->remove_control( 'genesis_image_alignment' ); } //* Rename menus add_theme_support( 'genesis-menus', array( 'primary' => __( 'After Header Menu', 'generate' ), 'secondary' => __( 'Footer Menu', 'generate' ) ) ); //* Reposition the secondary navigation menu remove_action( 'genesis_after_header', 'genesis_do_subnav' ); add_action( 'genesis_footer', 'genesis_do_subnav', 7 ); //* Reduce the secondary navigation menu to one level depth add_filter( 'wp_nav_menu_args', 'generate_secondary_menu_args' ); function generate_secondary_menu_args( $args ){ if( 'secondary' != $args['theme_location'] ) return $args; $args['depth'] = 1; return $args; } //* Remove default post image remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 ); //* Add featured image above the entry content add_action( 'genesis_entry_content', 'generate_featured_photo', 8 ); function generate_featured_photo() { if ( is_page() || ! genesis_get_option( 'content_archive_thumbnail' ) ) return; if ( $image = genesis_get_image( array( 'format' => 'url', 'size' => genesis_get_option( 'image_size' ) ) ) ) { printf( '<div class="featured-image"><img src="%s" alt="%s" class="entry-image"/></div>', $image, the_title_attribute( 'echo=0' ) ); } } //* Reposition the post info remove_action( 'genesis_entry_header', 'genesis_post_info', 12 ); add_action( 'genesis_entry_header', 'genesis_post_info', 5 ); //* Hook after home featured widget before the content add_action( 'genesis_after_header', 'generate_home_featured' ); function generate_home_featured() { if ( is_front_page() ) genesis_widget_area( 'home-featured', array( 'before' => '<div class="home-featured widget-area"><div class="wrap">', 'after' => '</div></div>', ) ); } //* Add support for 3-column footer widgets add_theme_support( 'genesis-footer-widgets', 3 ); //* Add support for after entry widget add_theme_support( 'genesis-after-entry-widget-area' ); //* Relocate after entry widget remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' ); add_action( 'genesis_after_entry', 'genesis_after_entry_widget_area', 5 ); //* Register widget areas genesis_register_sidebar( array( 'id' => 'home-featured', 'name' => __( 'Home Featured', 'generate' ), 'description' => __( 'Widgets in this section are featured at the top of the homepage.', 'generate' ), ) ); // Remove the line above when adding to functions.php // Add theme support for new menu // Add Footer Menu; Keep Primary and Secondary Menus add_theme_support ( 'genesis-menus' , array ( 'primary' => __( 'Primary Navigation Menu', 'genesis' ), 'secondary' => __( 'Secondary Navigation Menu', 'genesis' ), 'footer' => __( 'Footer Navigation Menu', 'genesis' ) ) ); // Remove the line above when adding to functions.php // Add attributes to markup // Add footer menu just above footer widget area add_action( 'genesis_before_footer', 'amethyst_footer_menu', 9 ); function amethyst_footer_menu() { genesis_nav_menu( array( 'theme_location' => 'footer', 'container' => 'div', 'container_class' => 'wrap', 'menu_class' => 'menu genesis-nav-menu menu-footer', 'depth' => 1 ) ); } // Remove the line above when adding to functions.php // Add custom attributes to footer navigation add_filter( 'genesis_attr_nav-footer', 'custom_add_nav_footer_attr' ); function custom_add_nav_footer_attr( $attributes ){ $attributes['role'] = 'navigation'; $attributes['itemscope'] = 'itemscope'; $attributes['itemtype'] = 'http://schema.org/SiteNavigationElement'; return $attributes; }
February 14, 2017 at 7:35 am #201122Victor FontModeratorYou didn't register the menu anywhere or display it. This is all you need. None of the code you are using is necessary.
function register_footer_menu() { register_nav_menu( 'footer' ,__( 'Footer Navigation Menu', 'genesis-footer-nav' )); } add_action( 'init', 'register_footer_menu' ); add_action( 'genesis_before_footer', 'show_footer_nav' ); function show_footer_nav() { $class = 'menu genesis-nav-menu menu-footer'; if ( genesis_superfish_enabled() ) { $class .= ' js-superfish'; } genesis_nav_menu( array( 'theme_location' => 'footer', 'menu_class' => $class, ) ); }
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 14, 2017 at 4:05 pm #201183TonySan1MemberThis reply has been marked as private. -
AuthorPosts
- The topic ‘Adding Additional Nav-Menu in Generate Pro Child theme Footer Area’ is closed to new replies.