Language Switch Function

You are now only testing for the theme location not to be empty. This means that every non empty menu location will see the language button attached. So, in stead of testing for emptyness you should be testing for a specific location. The name of that location depends on your theme, but suppose it’s called … Read more

Add a data attribute to list item element in menu

try this code in your functions file. function add_class_to_nav_items($nav_items, $args) { if ( $args[‘theme_location’] == ‘MY_NAV_THEME_LOCATION’ ) { // IMPORTANT: replace MY_NAV_THEME_LOCATION with the location of your menu foreach ($nav_items as &$nav_item) { $nav_item->classes[] = ‘custon-class-name’; } } return $nav_items; } add_filter( ‘wp_nav_menu_objects’, ‘add_class_to_nav_items’, 11 );

WordPress Menu Customizer

You can do this two ways. Add new section to existing nav_menus panel and then add your controls to the section: $wp_customize->add_section(‘my_section’, array( ‘title’ => ‘My options’, ‘panel’ => ‘nav_menus’ )); $wp_customize->add_setting(‘my_setting’, array( ‘type’ => ‘theme_mod’, ‘settings’ => ‘my_section’, ‘capability’ => ‘edit_theme_options’, ‘sanitize_callback’ => ‘sanitize_my_setting’ )); $wp_customize->add_control(‘my_control’, array( ‘label’ => ‘My option’, ‘section’ => ‘my_section’, … Read more

Foundation Scripts not loading (custom theme)

Benoti Yes, that was it! Seems app.js needs to be the last item loaded. Here is the final function with a couple of changes for anyone interested: function foundation_scripts() { wp_deregister_script(‘jquery’); wp_register_script(‘jquery’, get_template_directory_uri().’/js/vendor/jquery.js’, false); wp_enqueue_script(‘jquery’); wp_enqueue_script(‘foundation-js’, get_template_directory_uri().’/js/vendor/foundation.js’, array(‘jquery’), false, true); wp_enqueue_script(‘what-input’, get_template_directory_uri().’/js/vendor/what-input.js’, false, true); wp_enqueue_script(‘app’, get_template_directory_uri().’/js/app.js’, array(‘jquery’, ‘foundation-js’), false, true); }

Add a menu item to the logged in users author page?

You can use wp_nav_menu_items filter for this, and check if user logged in, and use get_author_posts_url($autho_id) as bravokeyl suggested: add_filter(‘wp_nav_menu_items’, function( $items, $args ) { $index = ‘top-menu’; // menu index key, if you’re not sure then var_dump( $args->theme_location ) global $current_user; if ( $current_user->ID && $index === $args->theme_location ) { $items .= sprintf( ‘<li … Read more