mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Nav menu cleanups. Props nbachiyski. see #11817
git-svn-id: https://develop.svn.wordpress.org/trunk@13375 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1120,18 +1120,8 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
|
||||
<ul class="custom-nav">
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
//DISPLAY custom navigation menu
|
||||
if ( get_option('wp_custom_nav_menu') == 'true' )
|
||||
wp_nav_menu( array('id' => $navmenu, 'name' => $wp_custom_nav_menu_name, 'desc' => $navwidgetdescription, 'format' => 'widget') );
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
//DEVELOPER settings enabled
|
||||
wp_nav_menu( array('id' => $navmenu, 'name' => $wp_custom_nav_menu_name, 'desc' => $navwidgetdescription, 'format' => 'widget') );
|
||||
//DEVELOPER settings enabled
|
||||
if ( $navdeveloper == 'yes' ) {
|
||||
//DISPLAY Custom UL
|
||||
if ( $navul == 'yes' ) {
|
||||
|
||||
@@ -104,7 +104,7 @@ function wp_print_nav_menu_item($menu_item, $context, $args = array() ) {
|
||||
<?php if ( 'backend' == $context ) { ?>
|
||||
<a><span class=""></span></a>
|
||||
<?php } else { ?>
|
||||
<a class="hide" href="<?php echo $menu_item->link; ?>"><?php echo $menu_item->title; ?></a>
|
||||
<a class="hide" href="<?php echo $menu_item->link; ?>"><?php echo esc_html( $menu_item->title ); ?></a>
|
||||
<?php } ?>
|
||||
<input type="hidden" name="dbid<?php echo $menu_item->menu_order; ?>" id="dbid<?php echo $menu_item->menu_order; ?>" value="<?php echo $menu_item->ID; ?>" />
|
||||
<input type="hidden" name="postmenu<?php echo $menu_item->menu_order; ?>" id="postmenu<?php echo $menu_item->menu_order; ?>" value="<?php echo esc_attr( get_post_meta( $menu_item->ID, 'object_id', true ) ); ?>" />
|
||||
@@ -148,11 +148,13 @@ function wp_print_nav_menu_item($menu_item, $context, $args = array() ) {
|
||||
break;
|
||||
|
||||
case 'default':
|
||||
$templatedir = get_bloginfo('url');
|
||||
$template_dir = get_bloginfo('url');
|
||||
?>
|
||||
<dl>
|
||||
<dt>
|
||||
<span class="title"><?php echo $menu_item->title; ?></span> <a onclick="appendToList('<?php echo esc_js( esc_url_raw( $templatedir ) ); ?>','<?php echo esc_js( $menu_item->append ); ?>','<?php echo esc_js( $menu_item->title ); ?>','<?php echo esc_js( $menu_item->link ); ?>','<?php echo esc_js( $menu_item->ID ); ?>','<?php echo esc_js( $menu_item->parent_item ); ?>','<?php echo esc_js( $menu_item->description ); ?>')" name="<?php echo esc_attr( $menu_item->title ); ?>" value="<?php echo esc_attr( $menu_item->link ); ?>"><img alt="<?php esc_attr_e('Add to Custom Menu'); ?>" title="<?php esc_attr_e('Add to Custom Menu'); ?>" src="<?php echo admin_url('images/ico-add.png'); ?>" /></a> </dt>
|
||||
<dt>
|
||||
<span class="title"><?php echo $menu_item->title; ?></span>
|
||||
<a onclick="appendToList('<?php echo esc_js( esc_url_raw( $template_dir ) ); ?>','<?php echo esc_js( $menu_item->append ); ?>','<?php echo esc_js( $menu_item->title ); ?>','<?php echo esc_js( $menu_item->link ); ?>','<?php echo esc_js( $menu_item->ID ); ?>','<?php echo esc_js( $menu_item->parent_item ); ?>','<?php echo esc_js( $menu_item->description ); ?>')" name="<?php echo esc_attr( $menu_item->title ); ?>" value="<?php echo esc_attr( $menu_item->link ); ?>"><img alt="<?php esc_attr_e('Add to Custom Menu'); ?>" title="<?php esc_attr_e('Add to Custom Menu'); ?>" src="<?php echo admin_url('images/ico-add.png'); ?>" /></a>
|
||||
</dt>
|
||||
</dl>
|
||||
<?php
|
||||
break;
|
||||
|
||||
@@ -25,7 +25,7 @@ function wp_create_nav_menu( $menu_name ) {
|
||||
$menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' );
|
||||
|
||||
if ( $menu_exists )
|
||||
return WP_Error('menu_exists', sprintf( __('A menu named "%s" already exists; please try another name.'), $menu_exists->name ));
|
||||
return new WP_Error('menu_exists', sprintf( __('A menu named “%s” already exists; please try another name.'), esc_html( $menu_exists->name ) ) );
|
||||
|
||||
$menu = wp_insert_term( $menu_name, 'nav_menu' );
|
||||
if ( is_wp_error($menu) )
|
||||
@@ -97,16 +97,16 @@ function wp_setup_nav_menu_item($menu_item, $type = 'item', $position = 0) {
|
||||
$menu_item->link = get_page_link( $menu_item->object_id );
|
||||
|
||||
if ( $menu_item->post_title == '' )
|
||||
$menu_item->title = htmlentities( get_the_title( $menu_item->object_id ) );
|
||||
$menu_item->title = get_the_title( $menu_item->object_id );
|
||||
else
|
||||
$menu_item->title = htmlentities( $menu_item->post_title );
|
||||
$menu_item->title = $menu_item->post_title;
|
||||
|
||||
if ( $menu_item->post_content == '' )
|
||||
$menu_item->description = htmlentities( get_post_meta( $menu_item->ID, 'page-description', true ) );
|
||||
$menu_item->description = get_post_meta( $menu_item->ID, 'page-description', true );
|
||||
else
|
||||
$menu_item->description = htmlentities( $menu_item->post_content );
|
||||
$menu_item->description = $menu_item->post_content;
|
||||
$menu_item->target = '';
|
||||
$menu_item->append = 'Page';
|
||||
$menu_item->append = _x('Page', 'menu nav item type');
|
||||
break;
|
||||
// Category Menu Item
|
||||
case 'category':
|
||||
@@ -114,25 +114,25 @@ function wp_setup_nav_menu_item($menu_item, $type = 'item', $position = 0) {
|
||||
|
||||
if ( empty($menu_item->post_title) ) {
|
||||
$title_raw = get_category( $menu_item->object_id );
|
||||
$menu_item->title = htmlentities($title_raw->cat_name);
|
||||
$menu_item->title = $title_raw->cat_name;
|
||||
} else {
|
||||
$menu_item->title = htmlentities( $menu_item->post_title );
|
||||
$menu_item->title = $menu_item->post_title;
|
||||
}
|
||||
|
||||
if ( empty($menu_item->post_content) )
|
||||
$menu_item->description = htmlentities( strip_tags( category_description( $menu_item->object_id ) ) );
|
||||
$menu_item->description = strip_tags( category_description( $menu_item->object_id ) );
|
||||
else
|
||||
$menu_item->description = htmlentities( $menu_item->post_content );
|
||||
$menu_item->description = $menu_item->post_content;
|
||||
$menu_item->target = '';
|
||||
$menu_item->append = 'Category';
|
||||
$menu_item->append = _x('Category', 'menu nav item type');
|
||||
break;
|
||||
default:
|
||||
// Custom Menu Item
|
||||
$menu_item->link = $menu_item->guid;
|
||||
$menu_item->title = htmlentities( $menu_item->post_title );
|
||||
$menu_item->description = htmlentities( $menu_item->post_content );
|
||||
$menu_item->title = $menu_item->post_title;
|
||||
$menu_item->description = $menu_item->post_content;
|
||||
$menu_item->target = 'target="_blank"';
|
||||
$menu_item->append = 'Custom';
|
||||
$menu_item->append = _x('Custom', 'menu nav item type');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ function wp_setup_nav_menu_item($menu_item, $type = 'item', $position = 0) {
|
||||
|
||||
//SET anchor title
|
||||
if (isset($wp_custom_nav_menu_items->custom_anchor_title)) {
|
||||
$anchor_title = htmlentities($wp_custom_nav_menu_items->custom_anchor_title);
|
||||
$anchor_title = $wp_custom_nav_menu_items->custom_anchor_title;
|
||||
}
|
||||
else {
|
||||
$anchor_title = $title;
|
||||
|
||||
@@ -398,7 +398,13 @@ function wp_default_scripts( &$scripts ) {
|
||||
|
||||
// Custom Navigation
|
||||
$scripts->add( 'custom-navigation-default-items', "/wp-admin/js/custom-navigation-default-items$suffix.js", false, '20100223' );
|
||||
$scripts->add( 'custom-navigation-dynamic-functions', "/wp-admin/js/custom-navigation-dynamic-functions$suffix.js", false, '20100220' );
|
||||
$scripts->add( 'custom-navigation-dynamic-functions', "/wp-admin/js/custom-navigation-dynamic-functions$suffix.js", false, '20100224' );
|
||||
$scripts->localize( 'custom-navigation-dynamic-functions', 'navMenuL10n', array(
|
||||
'custom' => _x('Custom', 'menu nav item type'),
|
||||
'page' => _x('Page', 'menu nav item type'),
|
||||
'category' => _x('Category', 'menu nav item type')
|
||||
) );
|
||||
|
||||
$scripts->add( 'custom-navigation-php-functions', "/wp-admin/js/custom-navigation-php-functions$suffix.js", false, '20100220' );
|
||||
}
|
||||
}
|
||||
@@ -468,7 +474,7 @@ function wp_default_styles( &$styles ) {
|
||||
$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
|
||||
$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
|
||||
$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
|
||||
$styles->add( 'custom-navigation', "/wp-admin/css/custom-navigation$suffix.css", array(), '20100223' );
|
||||
$styles->add( 'custom-navigation', "/wp-admin/css/custom-navigation$suffix.css", array(), '20100224' );
|
||||
|
||||
foreach ( $rtl_styles as $rtl_style ) {
|
||||
$styles->add_data( $rtl_style, 'rtl', true );
|
||||
|
||||
Reference in New Issue
Block a user