public function unregister() { add_action('after_setup_theme', function () { unregister_nav_menu($this->location); }); return $this; }
function global_nav_menu_init() { if (!is_main_site()) { // Remove the menu from menu screens on sub sites to avoid confusions. unregister_nav_menu('global'); } }
function anp_register_menus() { register_nav_menu('network-menu', __('Main Menu')); unregister_nav_menu('main-nav'); unregister_nav_menu('secondary-nav'); unregister_nav_menu('utility-nav'); }
/** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */ function goran_setup() { /* * Declare textdomain for this child theme. */ load_child_theme_textdomain('goran', get_stylesheet_directory() . '/languages'); /* * Enable support for Post Thumbnails on posts and pages. * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_image_size('edin-thumbnail-landscape', 314, 228, true); add_image_size('edin-thumbnail-square', 314, 314, true); add_image_size('edin-featured-image', 772, 9999); add_image_size('edin-hero', 1230, 1230); /* * Unregister nav menu. */ unregister_nav_menu('secondary'); /* * Editor styles. */ add_editor_style(array('editor-style.css', goran_noto_sans_font_url(), goran_noto_serif_font_url(), goran_droid_sans_mono_font_url())); /** * Add support for Eventbrite. * See: https://wordpress.org/plugins/eventbrite-api/ */ add_theme_support('eventbrite'); }
function register_my_menu() { unregister_nav_menu('sidebar-menu'); unregister_nav_menu('extra-menu'); register_nav_menu('meta-links', __('Meta Menu')); register_nav_menu('footer-links', __('Footer Links')); register_nav_menu('seo-links', __('SEO Links')); }
/** * Sets up theme defaults and registers support for various WordPress and BuddyPress features. * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. * * @since 1.0 */ function status_setup() { // We're not using BP-Default's primary nav menu, or custom header images. unregister_nav_menu('primary'); remove_theme_support('custom-header'); // Enqueue javascript add_action('wp_enqueue_scripts', 'status_enqueue_scripts'); // Enqueue scripts add_action('wp_enqueue_scripts', 'bp_dtheme_enqueue_styles'); // This theme uses wp_nav_menu() in one location. register_nav_menus(array('admin_bar_nav' => __('Admin Bar Custom Navigation Menu', 'status'))); // Add theme support for post formats add_theme_support('post-formats', array('aside', 'gallery', 'link', 'video', 'image', 'quote', 'status', 'chat')); // This theme comes with all the BuddyPress goodies add_theme_support('buddypress'); }
function pbosfc_register_menus() { unregister_nav_menu('secondary'); do_action('pbosfc_before_register_menus'); register_nav_menus(array('left_top' => __('Left Top Menu', 'pbosfc'), 'right_top' => __('Right Top Menu', 'pbosfc'))); do_action('pbosfc_after_register_menus'); }
public static function unregister($name) { add_action('after_setup_theme', function () use($name) { unregister_nav_menu($name); }, 11); }
/** * @ticket 26900 */ function test_supports_menus() { // Start fresh foreach (get_registered_nav_menus() as $location => $desc) { unregister_nav_menu($location); } _remove_theme_support('menus'); $this->assertFalse(current_theme_supports('menus')); // Registering a nav menu automatically adds support. register_nav_menu('primary', 'Primary Navigation'); register_nav_menu('secondary', 'Secondary Navigation'); $this->assertTrue(current_theme_supports('menus')); // Support added internally, can't be removed. remove_theme_support('menus'); $this->assertTrue(current_theme_supports('menus')); // Still supports because of secondary. unregister_nav_menu('primary'); $this->assertTrue(current_theme_supports('menus')); // No longer support because we have no menus. unregister_nav_menu('secondary'); $this->assertEmpty(get_registered_nav_menus()); $this->assertFalse(current_theme_supports('menus')); }
/** * This function adds images sizes to WordPress. */ function after_setup_theme() { global $content_width; /** * Set the Content Width for embedded items. */ if (!isset($content_width)) { $content_width = 868; } // WooCommerce Support add_theme_support('woocommerce'); // Change default core markup for search form, comment form, and comments, etc... to HTML5 add_theme_support('html5', array('search-form', 'comment-form', 'comment-list')); // Custom Background (color/image) add_theme_support('custom-background', array('default-color' => '#000', 'default-image' => get_template_directory_uri() . '/images/pattern.png')); // Theme textdomain load_theme_textdomain('simple-shop', get_template_directory() . '/languages'); add_image_size('simple-shop-800x500', 800, 500, true); // Recent Posts Widget add_image_size('simple-shop-800x800', 800, 650, true); // WooCommerce Single Product add_image_size('simple-shop-425x280', 425, 280, true); // Blog Post add_image_size('simple-shop-1400x600', 1400, 600, false); // Single Post add_image_size('simple-shop-1600x9999', 1600, 9999, false); // Single Page // Unregister unused menus which are registered in SDS Core unregister_nav_menu('footer_nav'); }
/** * Unregisters the menu. * * @throws RuntimeException If the menu cannot be unregistered. */ public function unregister() { if (!unregister_nav_menu($this->getLocation())) { throw new RuntimeException('Cannot unregister the NavMenu.'); } }
function cherry_plugin_import_menu_item() { $nonce = $_POST['nonce']; if (!wp_verify_nonce($nonce, 'import_ajax-nonce')) { exit('instal_error'); } if (session_id() != "import_xml") { session_name("import_xml"); session_start(); } do_action('cherry_plugin_import_menu_item'); $_SESSION['missing_menu_items'] = array(); $posts_array = $_SESSION['posts']; $posts_array = apply_filters('wp_import_posts', $posts_array); unregister_nav_menu('Header Menu'); unregister_nav_menu('Footer Menu'); foreach ($posts_array as $post) { $post = apply_filters('wp_import_post_data_raw', $post); if ('nav_menu_item' == $post['post_type']) { cherry_plugin_add_item($post); } else { continue; } } unset($_SESSION['posts']); exit('import_attachment'); }
$menu_mnav_exists = wp_get_nav_menu_object( $menu_mnav ); if( !$menu_mnav_exists) { $menu_mnav_id = wp_create_nav_menu( $menu_mnav ); } $menu_fnav = 'Functional navigation - Test'; $menu_fnav_exists = wp_get_nav_menu_object( $menu_fnav ); if( !$menu_fnav_exists) { $menu_fnav_id = wp_create_nav_menu($menu_fnav); } */ register_nav_menus(array('header-mnav' => 'Header - Main navigation', 'header-fnav' => 'Header - Functional navigation', 'footer-nav' => 'Footer - In de kijker')); unregister_nav_menu('mnav'); unregister_nav_menu('fnav'); function wb_sidebar1() { register_sidebar(array('name' => __('Main Sidebar', 'eagle'), 'id' => 'main-sidebar', 'description' => __(' ', 'eagle'), 'class' => 'sidebar-default', 'before_widget' => '<div class="sidebar-default %2$s">', 'after_widget' => '</div>')); } add_action('widgets_init', 'wb_sidebar1'); if (!isset($content_width)) { $content_width = 600; } /* function editor_style() { add_editor_style( 'editor-style.css' ); } add_action( 'init', 'editor_style' ); */ //require_once( 'functions-inc/wordpress-dashboard.php' ); // WordPress dashboard settings
/** * This function adds images sizes to WordPress. */ public function after_setup_theme() { global $content_width; // Grab the Baton Customizer instance $baton_customizer = Baton_Customizer_Instance(); // Set the Content Width for embedded items if (!isset($content_width)) { $content_width = 1272; } // Determine if the max width theme mod is set if (($max_width = $baton_customizer->get_theme_mod('baton_max_width')) && $max_width !== $content_width) { $content_width = $max_width; } // Change default core markup for search form, comment form, and comments, etc... to HTML5 add_theme_support('html5', array('search-form', 'comment-form', 'comment-list')); // Custom Background (color/image) add_theme_support('custom-background', array('default-color' => $baton_customizer->get_current_color_scheme_default('background_color', '#f1f5f9'))); // Custom Logo add_theme_support('custom-logo', array('width' => 300, 'height' => 100, 'flex-height' => true)); // Yoast WordPress SEO Breadcrumbs (automatically enables breadcrumbs) //add_theme_support( 'yoast-seo-breadcrumbs', true ); // Theme textdomain load_theme_textdomain('baton', get_template_directory() . '/languages'); add_image_size('baton-600x400', 600, 400, true); // Portfolio Archive Page Featured Image Size add_image_size('baton-1200x9999', 1200, 9999, false); // Single Post/Page Featured Image Size add_image_size('baton-conductor-small', 375, 9999, false); // Conductor Small Widgets add_image_size('baton-conductor-small-cropped', 375, 250, true); // Conductor Small Widgets (cropped) add_image_size('baton-conductor-medium', 760, 9999, false); // Conductor Medium Widgets add_image_size('baton-conductor-medium-cropped', 760, 500, true); // Conductor Medium Widgets (cropped) add_image_size('baton-conductor-large', 1200, 9999, false); // Conductor Large Widgets add_image_size('baton-conductor-large-cropped', 1200, 1200, false); // Conductor Large Widgets (cropped) // Register menus which are used in Baton register_nav_menus(array('secondary_nav' => __('Secondary Navigation', 'baton'))); // Unregister menus which are registered in SDS Core unregister_nav_menu('top_nav'); }
/** * Process menu items * * Import Step#10 * * @since 1.0.0 */ function import_menu_item() { $this->verify_nonce(); $_SESSION['missing_menu_items'] = array(); $menu_items = $_SESSION['menu_items']; if (empty($menu_items)) { exit('import_attachment'); } $menus = get_transient($this->transients_prefix . 'menus'); /** * Get menu meta keys to update on import from theme and plugins * @var array */ $menu_extra_meta = apply_filters('cherry_data_manager_menu_meta', array()); if ($menus && is_array($menus)) { foreach ($menus as $location) { unregister_nav_menu($location); } } foreach ($menu_items as $post) { $post = apply_filters('wp_import_post_data_raw', $post); $this->add_menu_item($post, $menu_extra_meta); } unset($_SESSION['posts']); /** * Hook fires after successfull menu items import */ do_action('cherry_data_manager_import_menu_item'); exit('import_attachment'); }
function after_setup_theme() { global $content_width; /** * Set the Content Width for embeded items. */ if (!isset($content_width)) { $content_width = 685; } // Theme Hook Alliance support add_theme_support('tha_hooks', array('all')); add_image_size('me-200x300', 200, 300, true); // Used on the front page, blog page, and archive page add_image_size('me-685x300', 685, 300, true); // Used on single posts and pages add_image_size('me-1022x300', 1022, 300, true); // Used on full width and landing page templates // WooCommerce Support add_theme_support('woocommerce'); // Remove footer nav which is registered in options panel unregister_nav_menu('footer_nav'); // Change default core markup for search form, comment form, and comments, etc... to HTML5 add_theme_support('html5', array('search-form', 'comment-form', 'comment-list')); // Custom Background (color/image) $custom_background_args = array(); // Check for color scheme default value if (($selected_color_scheme = sds_get_color_scheme(false)) && isset($selected_color_scheme['background_color'])) { $custom_background_args['default-color'] = $selected_color_scheme['background_color']; } add_theme_support('custom-background', $custom_background_args); // Theme textdomain load_theme_textdomain('modern-estate', get_template_directory() . '/languages'); }
function remove_parent_navs() { unregister_nav_menu('sidebar-menu'); unregister_nav_menu('extra-menu'); }
} $wp_customize->add_control($setting_use_name, $args); } } } } if ($wp_customize->is_preview() && !is_admin()) { add_action('wp_footer', 'wptouch_customizer_ajax_callbacks', 21); } } } else { // In the customizer and editing the desktop theme. To keep things tidy, hide mobile menu locations in the menu picker $menus = get_registered_nav_menus(); foreach ($menus as $identifier => $menu) { if (strstr($identifier, 'wptouch_')) { unregister_nav_menu($identifier); } } } } function wptouch_customizer_initialize() { // When we first access the customizer, construct its settings data from the existing WPtouch settings object (if any). This will ensure any inherited values are shown correctly. global $customizable_settings; global $wptouch_pro; $domains = $wptouch_pro->get_active_setting_domains(); foreach ($domains as $domain) { $settings = wptouch_get_settings($domain); wptouch_customizer_restore_settings($domain, $settings); } }
function register_my_menus() { register_nav_menus(array('juice-menu' => __('I Love Juice Main menu'))); unregister_nav_menu("main-menu"); }