wp_nav_menu_locations_meta_box [ WordPress Function ]
wp_nav_menu_locations_meta_box ( No parameters )
| Defined at: |
|
Benzer Fonksiyonlar: wp_nav_menu_taxonomy_meta_boxes, wp_nav_menu_item_link_meta_box, wp_nav_menu_item_taxonomy_meta_box, wp_nav_menu_item_post_type_meta_box, wp_nav_menu_post_type_meta_boxes
Displays a metabox for the nav menu theme locations.
Source
<?php
function wp_nav_menu_locations_meta_box() {
global $nav_menu_selected_id;
if ( ! current_theme_supports( 'menus' ) ) {
// We must only support widgets. Leave a message and bail.
echo '<p class="howto">' . __('The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.') . '</p>';
return;
}
$locations = get_registered_nav_menus();
$menus = wp_get_nav_menus();
$menu_locations = get_nav_menu_locations();
$num_locations = count( array_keys($locations) );
echo '<p class="howto">' . sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n($num_locations) ) . '</p>';
foreach ( $locations as $location => $description ) {
?>
<p>
<label class="howto" for="locations-<?php echo $location; ?>">
<span><?php echo $description; ?></span>
<select name="menu-locations[<?php echo $location; ?>]" id="locations-<?php echo $location; ?>">
<option value="0"></option>
<?php foreach ( $menus as $menu ) : ?>
<option<?php selected( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $menu->term_id ); ?>
value="<?php echo $menu->term_id; ?>"><?php
$truncated_name = wp_html_excerpt( $menu->name, 40 );
echo $truncated_name == $menu->name ? $menu->name : trim( $truncated_name ) . '…';
?></option>
<?php endforeach; ?>
</select>
</label>
</p>
<?php
}
?>
<p class="button-controls">
<img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
<?php submit_button( __( 'Save' ), 'primary', 'nav-menu-locations', false, disabled( $nav_menu_selected_id, 0, false ) ); ?>
</p>
<?php
}
?>
Examples [ wp-snippets.com ]
Google Arama Sonuçlarý
- PHPXRef 0.7 : WordPress : Detail view of nav-menu.php
wp_nav_menu_locations_meta_box() ...
phpxref.ftwr.co.uk - nav-menu.php - PHP Cross Reference of WordPress Source - Yoast
wp_nav_menu_locations_meta_box() ...
xref.yoast.com - Docs for page nav-menu.php
wp_nav_menu_locations_meta_box (line 477). Displays a metabox for the nav menu theme locations. since: 3.0.0. void wp_nav_menu_locations_meta_box () ...
phpdoc.wordpress.org - Remove Metabox from Menus screen - WordPress - Stack Exchange
Mar 30, 2012... capability if (current_user_can('manage_options') == false) { remove_meta_box('wp_nav_menu_locations_meta_box', 'nav-menus', 'side'); ...
wordpress.stackexchange.com