Nav menu cleanups. Props nbachiyski. see #11817
git-svn-id: http://svn.automattic.com/wordpress/trunk@13375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a762587cca
commit
12f9c6113e
File diff suppressed because one or more lines are too long
|
@ -161,6 +161,3 @@ img.remove, img.edit { cursor: pointer; margin: 0 5px 0 0; }
|
||||||
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
||||||
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); }
|
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); }
|
||||||
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 8px; -webkit-border-radius: 8px; }
|
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); -moz-border-radius: 8px; -webkit-border-radius: 8px; }
|
||||||
|
|
||||||
|
|
||||||
#reset_wp_menu { background:#c77 none !important;color:white!important;text-shadow:0 1px 0 #555 !important;}
|
|
||||||
|
|
|
@ -29,27 +29,27 @@ function wp_nav_menu_get_pages($counter, $type) {
|
||||||
//GET all pages
|
//GET all pages
|
||||||
$pages_array = get_pages($pages_args);
|
$pages_array = get_pages($pages_args);
|
||||||
|
|
||||||
$intCounter = $counter;
|
$items_counter = $counter;
|
||||||
$parentli = $intCounter;
|
$parentli = $items_counter;
|
||||||
|
|
||||||
if ( !$pages_array ) {
|
if ( !$pages_array ) {
|
||||||
echo 'Not Found';
|
echo __('Not Found');
|
||||||
return $intCounter;
|
return $items_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display Loop
|
// Display Loop
|
||||||
foreach ( $pages_array as $post ) {
|
foreach ( $pages_array as $post ) {
|
||||||
if ( $post->post_parent == 0 ) {
|
if ( $post->post_parent == 0 ) {
|
||||||
$post = wp_setup_nav_menu_item($post, 'page', $intCounter);
|
$post = wp_setup_nav_menu_item($post, 'page', $items_counter);
|
||||||
if ( $type == 'menu' ) {
|
if ( $type == 'menu' ) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<li id="menu-<?php echo $intCounter; ?>" value="<?php echo $intCounter; ?>">
|
<li id="menu-<?php echo $items_counter; ?>" value="<?php echo $items_counter; ?>">
|
||||||
<?php
|
<?php
|
||||||
wp_print_nav_menu_item($post, 'menu', $intCounter);
|
wp_print_nav_menu_item($post, 'menu', $items_counter);
|
||||||
$parentli = $post->ID;
|
$parentli = $post->ID;
|
||||||
$intCounter++;
|
$items_counter++;
|
||||||
$intCounter = wp_custom_navigation_default_sub_items($post->ID, $intCounter, $parentli, 'pages', 'menu');
|
$items_counter = wp_custom_navigation_default_sub_items($post->ID, $items_counter, $parentli, 'pages', 'menu');
|
||||||
?>
|
?>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ function wp_nav_menu_get_pages($counter, $type) {
|
||||||
<?php
|
<?php
|
||||||
wp_print_nav_menu_item($post, 'default');
|
wp_print_nav_menu_item($post, 'default');
|
||||||
$parentli = $post->ID;
|
$parentli = $post->ID;
|
||||||
$intCounter++;
|
$items_counter++;
|
||||||
$intCounter = wp_nav_menu_sub_items($post->ID, $intCounter, $parentli, 'pages', 'default');
|
$items_counter = wp_nav_menu_sub_items($post->ID, $items_counter, $parentli, 'pages', 'default');
|
||||||
?>
|
?>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ function wp_nav_menu_get_pages($counter, $type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $intCounter;
|
return $items_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outputs All Categories and Sub Items
|
// Outputs All Categories and Sub Items
|
||||||
|
@ -90,30 +90,30 @@ function wp_nav_menu_get_categories($counter, $type) {
|
||||||
'number' => '',
|
'number' => '',
|
||||||
'pad_counts' => false );
|
'pad_counts' => false );
|
||||||
|
|
||||||
$intCounter = $counter;
|
$items_counter = $counter;
|
||||||
|
|
||||||
// Get all categories
|
// Get all categories
|
||||||
$categories_array = get_categories($category_args);
|
$categories_array = get_categories($category_args);
|
||||||
|
|
||||||
if ( !$categories_array ) {
|
if ( !$categories_array ) {
|
||||||
_e('Not Found');
|
_e('Not Found');
|
||||||
return $intCounter;
|
return $items_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display Loop
|
// Display Loop
|
||||||
foreach ( $categories_array as $cat_item ) {
|
foreach ( $categories_array as $cat_item ) {
|
||||||
if ( $cat_item->parent == 0 ) {
|
if ( $cat_item->parent == 0 ) {
|
||||||
$cat_item = wp_setup_nav_menu_item($cat_item, 'category', $intCounter);
|
$cat_item = wp_setup_nav_menu_item($cat_item, 'category', $items_counter);
|
||||||
// Custom Menu
|
// Custom Menu
|
||||||
if ( $type == 'menu' ) {
|
if ( $type == 'menu' ) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<li id="menu-<?php echo $intCounter; ?>" value="<?php echo $intCounter; ?>">
|
<li id="menu-<?php echo $items_counter; ?>" value="<?php echo $items_counter; ?>">
|
||||||
<?php
|
<?php
|
||||||
wp_print_nav_menu_item($cat_item, 'menu');
|
wp_print_nav_menu_item($cat_item, 'menu');
|
||||||
$parentli = $cat_item->cat_ID;
|
$parentli = $cat_item->cat_ID;
|
||||||
$intCounter++;
|
$items_counter++;
|
||||||
$intCounter = wp_nav_menu_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories', 'menu');
|
$items_counter = wp_nav_menu_sub_items($cat_item->cat_ID, $items_counter, $parentli, 'categories', 'menu');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
@ -126,8 +126,8 @@ function wp_nav_menu_get_categories($counter, $type) {
|
||||||
<?php
|
<?php
|
||||||
wp_print_nav_menu_item($cat_item, 'default');
|
wp_print_nav_menu_item($cat_item, 'default');
|
||||||
$parentli = $cat_item->cat_ID;
|
$parentli = $cat_item->cat_ID;
|
||||||
$intCounter++;
|
$items_counter++;
|
||||||
$intCounter = wp_nav_menu_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories', 'default');
|
$items_counter = wp_nav_menu_sub_items($cat_item->cat_ID, $items_counter, $parentli, 'categories', 'default');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
|
@ -137,13 +137,13 @@ function wp_nav_menu_get_categories($counter, $type) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $intCounter;
|
return $items_counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
//RECURSIVE Sub Menu Items of default categories and pages
|
//RECURSIVE Sub Menu Items of default categories and pages
|
||||||
function wp_nav_menu_sub_items($childof, $intCounter, $parentli, $type, $output_type) {
|
function wp_nav_menu_sub_items($childof, $items_counter, $parentli, $type, $output_type) {
|
||||||
|
|
||||||
$counter = $intCounter;
|
$counter = $items_counter;
|
||||||
|
|
||||||
// Custom Menu
|
// Custom Menu
|
||||||
if ( $output_type == 'menu' ) {
|
if ( $output_type == 'menu' ) {
|
||||||
|
|
|
@ -115,7 +115,7 @@ function updatepostdata()
|
||||||
jQuery(this).find('dl > dt > span > #remove' + j).attr('onClick', 'removeitem(' + i + ')');
|
jQuery(this).find('dl > dt > span > #remove' + j).attr('onClick', 'removeitem(' + i + ')');
|
||||||
jQuery(this).find('dl > dt > span > #remove' + j).attr('id','remove' + i);
|
jQuery(this).find('dl > dt > span > #remove' + j).attr('id','remove' + i);
|
||||||
|
|
||||||
jQuery('#licount').attr('value',i);
|
jQuery('#li-count').attr('value',i);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -142,16 +142,16 @@ function appendToList(templatedir,additemtype,itemtext,itemurl,itemid,itemparent
|
||||||
var inputdescription = '';
|
var inputdescription = '';
|
||||||
var inputicon = '';
|
var inputicon = '';
|
||||||
|
|
||||||
if (additemtype == 'Custom')
|
if (additemtype == navMenuL10n.custom)
|
||||||
{
|
{
|
||||||
inputvaluevarname = document.getElementById('custom_menu_item_name').value;
|
inputvaluevarname = document.getElementById('custom-menu-item-name').value;
|
||||||
inputvaluevarurl = document.getElementById('custom_menu_item_url').value;
|
inputvaluevarurl = document.getElementById('custom-menu-item-url').value;
|
||||||
inputitemid = '';
|
inputitemid = '';
|
||||||
inputparentid = '';
|
inputparentid = '';
|
||||||
inputlinktype = 'custom';
|
inputlinktype = 'custom';
|
||||||
inputdescription = document.getElementById('custom_menu_item_description').value;
|
inputdescription = '';
|
||||||
}
|
}
|
||||||
else if (additemtype == 'Page')
|
else if (additemtype == navMenuL10n.page)
|
||||||
{
|
{
|
||||||
inputvaluevarname = htmlentities(itemtext.toString());
|
inputvaluevarname = htmlentities(itemtext.toString());
|
||||||
inputvaluevarurl = itemurl.toString();
|
inputvaluevarurl = itemurl.toString();
|
||||||
|
@ -161,7 +161,7 @@ function appendToList(templatedir,additemtype,itemtext,itemurl,itemid,itemparent
|
||||||
inputdescription = htmlentities(itemdescription.toString());
|
inputdescription = htmlentities(itemdescription.toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (additemtype == 'Category')
|
else if (additemtype == navMenuL10n.category)
|
||||||
{
|
{
|
||||||
inputvaluevarname = htmlentities(itemtext.toString());
|
inputvaluevarname = htmlentities(itemtext.toString());
|
||||||
inputvaluevarurl = itemurl.toString();
|
inputvaluevarurl = itemurl.toString();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -31,25 +31,25 @@ require_once(ABSPATH . 'wp-admin/includes/nav-menu.php');
|
||||||
|
|
||||||
function wp_reset_nav_menu() {
|
function wp_reset_nav_menu() {
|
||||||
wp_nav_menu_setup(true);
|
wp_nav_menu_setup(true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$messagesdiv = '';
|
$messages_div = '';
|
||||||
$menu_id_in_edit = 0;
|
$menu_id_in_edit = 0;
|
||||||
$updated = false;
|
$updated = false;
|
||||||
|
$advanced_option_descriptions = 'no';
|
||||||
|
|
||||||
// Check which menu is selected and if menu is in edit already
|
// Check which menu is selected and if menu is in edit already
|
||||||
if ( isset( $_GET['edit_menu'] ) ) {
|
if ( isset( $_GET['edit-menu'] ) ) {
|
||||||
$menu_selected_id = (int) $_GET['edit_menu'];
|
$menu_selected_id = (int) $_GET['edit-menu'];
|
||||||
$updated = true;
|
$updated = true;
|
||||||
} elseif ( isset( $_POST[ 'menu_id_in_edit' ] ) ) {
|
} elseif ( isset( $_POST[ 'menu-id-in-edit' ] ) ) {
|
||||||
$menu_selected_id = (int) $_POST[ 'menu_id_in_edit' ];
|
$menu_selected_id = (int) $_POST[ 'menu-id-in-edit' ];
|
||||||
} else {
|
} else {
|
||||||
$menu_selected_id = 0;
|
$menu_selected_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST[ 'delete_menu' ] ) && $menu_selected_id > 0 ) {
|
if ( isset( $_POST[ 'delete-menu' ] ) && $menu_selected_id > 0 ) {
|
||||||
wp_delete_nav_menu( $menu_selected_id );
|
wp_delete_nav_menu( $menu_selected_id );
|
||||||
$menu_selected_id = 0;
|
$menu_selected_id = 0;
|
||||||
$updated = true;
|
$updated = true;
|
||||||
|
@ -70,52 +70,51 @@ if ( $menu_selected_id > 0 ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $_POST['licount'] ) )
|
if ( isset( $_POST['li-count'] ) )
|
||||||
$postCounter = $_POST['licount'];
|
$post_counter = $_POST['li-count'];
|
||||||
else
|
else
|
||||||
$postCounter = 0;
|
$post_counter = 0;
|
||||||
|
|
||||||
// Create a new menu. Menus are stored as terms in the 'menu' taxonomy.
|
// Create a new menu. Menus are stored as terms in the 'menu' taxonomy.
|
||||||
if ( isset( $_POST['add_menu'] ) && ! $updated ) {
|
if ( isset( $_POST['add-menu'] ) && ! $updated ) {
|
||||||
update_option( 'wp_custom_nav_menu', $_POST['enable_wp_menu'] ); // Do we need this?
|
$insert_menu_name = $_POST['add-menu-name'];
|
||||||
$insert_menu_name = $_POST['add_menu_name'];
|
|
||||||
|
|
||||||
if ( $insert_menu_name != '' ) {
|
if ( $insert_menu_name ) {
|
||||||
$menu = wp_create_nav_menu($insert_menu_name);
|
$menu = wp_create_nav_menu( $insert_menu_name );
|
||||||
if ( is_wp_error($menu) ) {
|
if ( is_wp_error( $menu ) ) {
|
||||||
$messagesdiv = '<div id="message" class="error fade below-h2"><p>' . esc_html( $menu->get_error_message() ) . '</p></div>';
|
$messages_div = '<div id="message" class="error fade below-h2"><p>' . $menu->get_error_message() . '</p></div>';
|
||||||
} else {
|
} else {
|
||||||
$custom_menus[$menu->term_id] = $menu;
|
$custom_menus[$menu->term_id] = $menu;
|
||||||
$menu_selected_id = $menu->term_id;
|
$menu_selected_id = $menu->term_id;
|
||||||
$menu_id_in_edit = $menu_selected_id;
|
$menu_id_in_edit = $menu_selected_id;
|
||||||
$menu_title = $menu->name;
|
$menu_title = $menu->name;
|
||||||
$messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . esc_html( sprintf( __('"%s" menu has been created!'), $menu->name ) ) . '</p></div>';
|
$messages_div = '<div id="message" class="updated fade below-h2"><p>' . sprintf( __('“%s” menu has been created.'), esc_html( $menu->name ) ) . '</p></div>';
|
||||||
$postCounter = 0;
|
$post_counter = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$messagesdiv = '<div id="message" class="error fade below-h2"><p>' . __('Please enter a valid menu name.') . '</p></div>';
|
$messages_div = '<div id="message" class="error fade below-h2"><p>' . __('Please enter a valid menu name.') . '</p></div>';
|
||||||
}
|
}
|
||||||
$updated = true;
|
$updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
|
if ( $post_counter > 0 && $menu_selected_id > 0 && ! $updated ) {
|
||||||
$menu_items = wp_get_nav_menu_items( $menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID') );
|
$menu_items = wp_get_nav_menu_items( $menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID') );
|
||||||
$parent_menu_ids = array();
|
$parent_menu_ids = array();
|
||||||
|
|
||||||
// Loop through all POST variables
|
// Loop through all POST variables
|
||||||
for ( $k = 1; $k <= $postCounter; $k++ ) {
|
for ( $k = 1; $k <= $post_counter; $k++ ) {
|
||||||
if (isset($_POST['dbid'.$k])) { $db_id = $_POST['dbid'.$k]; } else { $db_id = 0; }
|
$db_id = isset( $_POST['dbid'.$k] )? $_POST['dbid'.$k] : 0;
|
||||||
if (isset($_POST['postmenu'.$k])) { $object_id = $_POST['postmenu'.$k]; } else { $object_id = 0; }
|
$object_id = isset( $_POST['postmenu'.$k] )? $_POST['postmenu'.$k] : 0;
|
||||||
if (isset($_POST['parent'.$k])) { $parent_id = $_POST['parent'.$k]; } else { $parent_id = 0; }
|
$parent_id = isset( $_POST['parent'.$k] )? $_POST['parent'.$k] : 0;
|
||||||
if (isset($_POST['title'.$k])) { $custom_title = $_POST['title'.$k]; } else { $custom_title = ''; }
|
$custom_title = isset( $_POST['title'.$k] )? $_POST['title'.$k] : '';
|
||||||
if (isset($_POST['linkurl'.$k])) { $custom_linkurl = $_POST['linkurl'.$k]; } else { $custom_linkurl = ''; }
|
$custom_linkurl = isset( $_POST['linkurl'.$k] )? $_POST['linkurl'.$k] : '';
|
||||||
if (isset($_POST['description'.$k])) { $custom_description = $_POST['description'.$k]; } else { $custom_description = ''; }
|
$custom_description = isset( $_POST['description'.$k] )? $_POST['description'.$k] : '';
|
||||||
// doesn't seem to be used by UI
|
// doesn't seem to be used by UI
|
||||||
if (isset($_POST['icon'.$k])) { $icon = $_POST['icon'.$k]; } else { $icon = 0; }
|
$icon = isset( $_POST['icon'.$k] )? $_POST['icon'.$k] : 0;
|
||||||
if (isset($_POST['position'.$k])) { $position = $_POST['position'.$k]; } else { $position = 0; }
|
$position = isset( $_POST['position'.$k] )? $_POST['position'.$k] : 0;
|
||||||
if (isset($_POST['linktype'.$k])) { $linktype = $_POST['linktype'.$k]; } else { $linktype = 'custom'; }
|
$linktype = isset( $_POST['linktype'.$k] )? $_POST['linktype'.$k] : 'custom';
|
||||||
if (isset($_POST['anchortitle'.$k])) { $custom_anchor_title = $_POST['anchortitle'.$k]; } else { $custom_anchor_title = $custom_title; }
|
$custom_anchor_title = isset( $_POST['anchortitle'.$k] )? $_POST['anchortitle'.$k] : $custom_title;
|
||||||
if (isset($_POST['newwindow'.$k])) { $new_window = $_POST['newwindow'.$k]; } else { $new_window = 0; }
|
$new_window = isset( $_POST['newwindow'.$k] )? $_POST['newwindow'.$k] : 0;
|
||||||
|
|
||||||
$post = array( 'post_status' => 'publish', 'post_type' => 'nav_menu_item', 'post_author' => $user_ID,
|
$post = array( 'post_status' => 'publish', 'post_type' => 'nav_menu_item', 'post_author' => $user_ID,
|
||||||
'ping_status' => 0, 'post_parent' => 0, 'menu_order' => $position,
|
'ping_status' => 0, 'post_parent' => 0, 'menu_order' => $position,
|
||||||
|
@ -125,8 +124,8 @@ if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
|
||||||
$post['post_content_filtered'] = '_blank';
|
$post['post_content_filtered'] = '_blank';
|
||||||
else
|
else
|
||||||
$post['post_content_filtered'] = '';
|
$post['post_content_filtered'] = '';
|
||||||
if ( $parent_id > 0 && isset( $parent_menu_ids[ $parent_id ] ) )
|
if ( $parent_id > 0 && isset( $parent_menu_ids[$parent_id] ) )
|
||||||
$post[ 'post_parent' ] = $parent_menu_ids[ $parent_id ];
|
$post['post_parent'] = $parent_menu_ids[$parent_id];
|
||||||
|
|
||||||
// New menu item
|
// New menu item
|
||||||
if ( $db_id == 0 ) {
|
if ( $db_id == 0 ) {
|
||||||
|
@ -138,16 +137,15 @@ if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
|
||||||
}
|
}
|
||||||
$parent_menu_ids[ $k ] = $db_id;
|
$parent_menu_ids[ $k ] = $db_id;
|
||||||
|
|
||||||
update_post_meta($db_id, 'menu_type', $linktype);
|
update_post_meta( $db_id, 'menu_type', $linktype );
|
||||||
update_post_meta($db_id, 'object_id', $object_id);
|
update_post_meta( $db_id, 'object_id', $object_id );
|
||||||
}
|
}
|
||||||
if ( !empty( $menu_items ) ) {
|
if ( !empty( $menu_items ) ) {
|
||||||
foreach ( array_keys( $menu_items ) as $menu_id ) {
|
foreach ( array_keys( $menu_items ) as $menu_id ) {
|
||||||
wp_delete_post( $menu_id );
|
wp_delete_post( $menu_id );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// DISPLAY SUCCESS MESSAGE IF POST CORRECT
|
$messages_div = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>';
|
||||||
$messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -155,51 +153,48 @@ if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
|
||||||
<?php screen_icon(); ?>
|
<?php screen_icon(); ?>
|
||||||
<h2><?php esc_html_e('Menus') ?></h2>
|
<h2><?php esc_html_e('Menus') ?></h2>
|
||||||
<form onsubmit="updatepostdata()" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data">
|
<form onsubmit="updatepostdata()" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data">
|
||||||
<?php if ( ! empty( $custom_menus ) && count( $custom_menus ) > 1 ) { ?>
|
<?php if ( ! empty( $custom_menus ) && count( $custom_menus ) > 1 ): ?>
|
||||||
<ul class="subsubsub">
|
<ul class="subsubsub">
|
||||||
<?php
|
<?php
|
||||||
foreach ( $custom_menus as $menu ) {
|
foreach ( $custom_menus as $menu ) {
|
||||||
$sep = end($custom_menus) == $menu ? '' : ' | ';
|
$sep = end( $custom_menus ) == $menu ? '' : ' | ';
|
||||||
// $menu_term = get_term( $menu, 'nav_menu' );
|
|
||||||
if ( ( $menu_id_in_edit == $menu->term_id ) || ( $menu_selected_id == $menu->term_id ) ) { ?>
|
if ( ( $menu_id_in_edit == $menu->term_id ) || ( $menu_selected_id == $menu->term_id ) ) { ?>
|
||||||
<li><a href='nav-menus.php?edit_menu=<?php echo esc_attr($menu->term_id); ?>' class="current"><?php echo esc_html( $menu->name ); ?></a><?php echo $sep; ?></li>
|
<li><a href='nav-menus.php?edit-menu=<?php echo esc_attr($menu->term_id); ?>' class="current"><?php echo esc_html( $menu->name ); ?></a><?php echo $sep; ?></li>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<li><a href='nav-menus.php?edit_menu=<?php echo esc_attr($menu->term_id); ?>'><?php echo esc_html( $menu->name ); ?></a><?php echo $sep; ?></li>
|
<li><a href='nav-menus.php?edit-menu=<?php echo esc_attr($menu->term_id); ?>'><?php echo esc_html( $menu->name ); ?></a><?php echo $sep; ?></li>
|
||||||
<?php }
|
<?php }
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
<?php } ?>
|
<?php endif ?>
|
||||||
|
|
||||||
<div class="hide-if-js error"><p><?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Menus functionality.'); ?></p></div>
|
<div class="hide-if-js error"><p><?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Menus functionality.'); ?></p></div>
|
||||||
<div class="hide-if-no-js">
|
<div class="hide-if-no-js">
|
||||||
<div id="pages-left">
|
<div id="pages-left">
|
||||||
<div class="inside">
|
<div class="inside">
|
||||||
<?php if ( ! empty( $custom_menus ) ) : ?>
|
<?php if ( ! empty( $custom_menus ) ) : ?>
|
||||||
<?php echo $messagesdiv; ?>
|
<?php echo $messages_div; ?>
|
||||||
|
|
||||||
<input type="hidden" name="licount" id="licount" value="0" />
|
<input type="hidden" name="li-count" id="li-count" value="0" />
|
||||||
<input type="hidden" name="menu_id_in_edit" id="menu_id_in_edit" value="<?php echo esc_attr($menu_selected_id); ?>" />
|
<input type="hidden" name="menu-id-in-edit" id="menu-id-in-edit" value="<?php echo esc_attr( $menu_selected_id ); ?>" />
|
||||||
|
|
||||||
<div class="sidebar-name">
|
<div class="sidebar-name">
|
||||||
<div class="sidebar-name-arrow">
|
<div class="sidebar-name-arrow">
|
||||||
<br/>
|
<br/>
|
||||||
</div>
|
</div>
|
||||||
<h3><?php echo esc_html($menu_title); ?></h3>
|
<h3><?php echo esc_html( $menu_title ); ?></h3>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="nav-container">
|
<div id="nav-container">
|
||||||
<ul id="custom-nav">
|
<ul id="custom-nav">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
//DISPLAY existing menu
|
|
||||||
if ( $menu_selected_id > 0 ) {
|
if ( $menu_selected_id > 0 ) {
|
||||||
wp_print_nav_menu( 'type=backend&name='.$menu_title.'&id='.$menu_selected_id );
|
wp_print_nav_menu( array( 'type' => 'backend', 'name' => $menu_title, 'id' => $menu_selected_id ) );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div><!-- /#nav-container -->
|
</div><!-- /#nav-container -->
|
||||||
|
|
||||||
|
@ -209,7 +204,7 @@ if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
|
||||||
updatepostdata();
|
updatepostdata();
|
||||||
</script>
|
</script>
|
||||||
<input id="save_bottom" name="save_bottom" type="submit" value="<?php esc_attr_e('Save All Changes'); ?>" />
|
<input id="save_bottom" name="save_bottom" type="submit" value="<?php esc_attr_e('Save All Changes'); ?>" />
|
||||||
<input id="delete_menu" name="delete_menu" type="submit" value="<?php esc_attr_e('Delete This Menu'); ?>" />
|
<input id="delete-menu" name="delete-menu" type="submit" value="<?php esc_attr_e('Delete This Menu'); ?>" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
|
@ -227,128 +222,71 @@ if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
|
||||||
<div class="widget-holder">
|
<div class="widget-holder">
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
<input id="add_menu_name" name="add_menu_name" type="text" value="" />
|
<input id="add-menu-name" name="add-menu-name" type="text" value="" />
|
||||||
<input id="add_menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add_menu" class="button" />
|
<input id="add-menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add-menu" class="button" />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.widgets-holder-wrap -->
|
</div><!-- /.widgets-holder-wrap -->
|
||||||
<?php /* ?>
|
|
||||||
<?php $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); ?>
|
|
||||||
<div class="widgets-holder-wrap" style="display:none;">
|
|
||||||
<div class="sidebar-name">
|
|
||||||
<div class="sidebar-name-arrow"></div>
|
|
||||||
<h3><?php esc_html_e('Top Level Menu Descriptions'); ?></h3>
|
|
||||||
</div>
|
|
||||||
<div class="widget-holder">
|
|
||||||
<span><?php _e('Display Descriptions in Top Level Menu?'); ?></span>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
// UPDATE and DISPLAY Menu Description Option
|
|
||||||
if ( isset($_POST['menu-descriptions']) ) {
|
|
||||||
if ( !isset($_POST['switch_menu']) ) {
|
|
||||||
$menu_options_to_edit = $_POST['menu_id_in_edit'];
|
|
||||||
update_option('wp_settings_custom_nav_'.$menu_options_to_edit.'_descriptions',$_POST['menu-descriptions']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $menu_id_in_edit > 0 )
|
|
||||||
$checkedraw = get_option('wp_settings_custom_nav_'.$menu_id_in_edit.'_descriptions');
|
|
||||||
else
|
|
||||||
$checkedraw = get_option('wp_settings_custom_nav_'.$menu_selected_id.'_descriptions');
|
|
||||||
|
|
||||||
$checked = strtolower($checkedraw);
|
|
||||||
|
|
||||||
if ( $advanced_option_descriptions == 'no' )
|
|
||||||
$checked = 'no';
|
|
||||||
?>
|
|
||||||
|
|
||||||
<span class="checkboxes">
|
|
||||||
<label><?php _e('Yes'); ?></label><input type="radio" name="menu-descriptions" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> />
|
|
||||||
<label><?php _e('No'); ?></label><input type="radio" name="menu-descriptions" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> />
|
|
||||||
</span><!-- /.checkboxes -->
|
|
||||||
</form>
|
|
||||||
<div class="fix"></div>
|
|
||||||
</div>
|
|
||||||
</div><!-- /.widgets-holder-wrap -->
|
|
||||||
<?php */ ?>
|
|
||||||
<div class="widgets-holder-wrap">
|
<div class="widgets-holder-wrap">
|
||||||
<div class="sidebar-name">
|
<div class="sidebar-name">
|
||||||
<div class="sidebar-name-arrow"></div>
|
<div class="sidebar-name-arrow"></div>
|
||||||
<h3><?php esc_html_e('Add an Existing Page'); ?></h3>
|
<h3><?php esc_html_e('Add an Existing Page'); ?></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="widget-holder">
|
<div class="widget-holder">
|
||||||
|
<?php
|
||||||
<?php
|
$pages_args = array(
|
||||||
$pages_args = array(
|
'child_of' => 0,
|
||||||
'child_of' => 0,
|
'sort_order' => 'ASC',
|
||||||
'sort_order' => 'ASC',
|
'sort_column' => 'post_title',
|
||||||
'sort_column' => 'post_title',
|
'hierarchical' => 1,
|
||||||
'hierarchical' => 1,
|
'exclude' => '',
|
||||||
'exclude' => '',
|
'include' => '',
|
||||||
'include' => '',
|
'meta_key' => '',
|
||||||
'meta_key' => '',
|
'meta_value' => '',
|
||||||
'meta_value' => '',
|
'authors' => '',
|
||||||
'authors' => '',
|
'parent' => -1,
|
||||||
'parent' => -1,
|
'exclude_tree' => '',
|
||||||
'exclude_tree' => '',
|
'number' => '',
|
||||||
'number' => '',
|
'offset' => 0
|
||||||
'offset' => 0 );
|
);
|
||||||
|
$page_name = '';
|
||||||
//GET all pages
|
$pages_array = get_pages($pages_args);
|
||||||
$pages_array = get_pages($pages_args);
|
if ( $pages_array ) {
|
||||||
$page_name = '';
|
foreach ( $pages_array as $post ) {
|
||||||
//CHECK if pages exist
|
$page_name .= $post->post_title . '|';
|
||||||
if ( $pages_array ) {
|
}
|
||||||
foreach ( $pages_array as $post ) {
|
} else {
|
||||||
//Add page name to
|
$page_name = __('No pages available');
|
||||||
$page_name .= htmlentities($post->post_title).'|';
|
}
|
||||||
}
|
?>
|
||||||
} else {
|
<script type="text/javascript" charset="<?php bloginfo('charset'); ?>">
|
||||||
$page_name = __('No pages available');
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
jQuery(document).ready(function(){
|
jQuery(document).ready(function(){
|
||||||
|
var posts = "<?php echo esc_js( $page_name ); ?>".split("|");
|
||||||
//GET PHP pages
|
jQuery("#page-search").autocomplete(posts);
|
||||||
var dataposts = "<?php echo esc_js($page_name); ?>".split("|");
|
|
||||||
|
|
||||||
//Set autocomplete
|
|
||||||
jQuery("#page-search").autocomplete(dataposts);
|
|
||||||
|
|
||||||
//Handle autocomplete result
|
|
||||||
jQuery("#page-search").result(function(event, data, formatted) {
|
jQuery("#page-search").result(function(event, data, formatted) {
|
||||||
jQuery('#existing-pages').css('display','block');
|
jQuery('#existing-pages').css('display','block');
|
||||||
jQuery("#existing-pages dt:contains('" + data + "')").css("display", "block");
|
jQuery("#existing-pages dt:contains('" + data + "')").css("display", "block");
|
||||||
|
|
||||||
jQuery('#show-pages').hide();
|
jQuery('#show-pages').hide();
|
||||||
jQuery('#hide-pages').show();
|
jQuery('#hide-pages').show();
|
||||||
|
|
||||||
});
|
});
|
||||||
jQuery('#existing-pages').css('display','none');
|
jQuery('#existing-pages').css('display','none');
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input type="text" onfocus="jQuery('#page-search').attr('value','');" id="page-search" value="<?php esc_attr_e('Search Pages'); ?>" />
|
<input type="text" onfocus="jQuery('#page-search').attr('value','');" id="page-search" value="<?php esc_attr_e('Search Pages'); ?>" />
|
||||||
|
|
||||||
<a id="show-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','block');jQuery('#page-search').attr('value','');jQuery('#existing-pages dt').css('display','block');jQuery('#show-pages').hide();jQuery('#hide-pages').show();">View All</a>
|
<a id="show-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','block');jQuery('#page-search').attr('value','');jQuery('#existing-pages dt').css('display','block');jQuery('#show-pages').hide();jQuery('#hide-pages').show();"><?php _e('View All'); ?></a>
|
||||||
<a id="hide-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','none');jQuery('#page-search').attr('value','Search Pages');jQuery('#existing-pages dt').css('display','none');jQuery('#show-pages').show();jQuery('#hide-pages').hide();">Hide All</a>
|
<a id="hide-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','none');jQuery('#page-search').attr('value','Search Pages');jQuery('#existing-pages dt').css('display','none');jQuery('#show-pages').show();jQuery('#hide-pages').hide();"><?php _e('Hide All'); ?></a>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery('#hide-pages').hide();
|
jQuery('#hide-pages').hide();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul id="existing-pages" class="list">
|
<ul id="existing-pages" class="list">
|
||||||
<?php
|
<?php
|
||||||
$intCounter = 0;
|
$items_counter = wp_nav_menu_get_pages( 0,'default' );
|
||||||
//Get default Pages
|
?>
|
||||||
$intCounter = wp_nav_menu_get_pages($intCounter,'default');
|
|
||||||
?>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="fix"></div>
|
<div class="fix"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.widgets-holder-wrap -->
|
</div><!-- /.widgets-holder-wrap -->
|
||||||
|
|
||||||
|
@ -359,76 +297,59 @@ if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
|
||||||
</div>
|
</div>
|
||||||
<div class="widget-holder">
|
<div class="widget-holder">
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
// Custom GET categories query
|
// Custom GET categories query
|
||||||
// @todo Use API
|
// @todo Use API
|
||||||
$categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC");
|
$categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC");
|
||||||
$cat_name = '';
|
$cat_name = '';
|
||||||
//CHECK for results
|
if ( $categories ) {
|
||||||
if ( $categories ) {
|
foreach ( $categories as $category ) {
|
||||||
foreach ( $categories as $category ) {
|
$cat_id = $category->term_id;
|
||||||
$cat_id = $category->term_id;
|
$cat_args = array(
|
||||||
|
'orderby' => 'name',
|
||||||
$cat_args = array(
|
'include' => $cat_id,
|
||||||
'orderby' => 'name',
|
'hierarchical' => 1,
|
||||||
'include' => $cat_id,
|
'order' => 'ASC',
|
||||||
'hierarchical' => 1,
|
);
|
||||||
'order' => 'ASC'
|
$category_names = get_categories( $cat_args );
|
||||||
);
|
if ( isset( $category_names[0]->name ) ) {
|
||||||
|
$cat_name .= htmlentities( $category_names[0]->name ).'|';
|
||||||
$category_names=get_categories($cat_args);
|
}
|
||||||
|
}
|
||||||
if ( isset($category_names[0]->name) ) {
|
} else {
|
||||||
// Add category name to data string
|
$cat_name = __('No categories available');
|
||||||
$cat_name .= htmlentities($category_names[0]->name).'|';
|
}
|
||||||
}
|
?>
|
||||||
}
|
<script type="text/javascript" charset="<?php bloginfo('charset'); ?>">
|
||||||
} else {
|
|
||||||
$cat_name = __('No categories available');
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
jQuery(document).ready(function(){
|
jQuery(document).ready(function(){
|
||||||
|
var categories = "<?php echo esc_js($cat_name); ?>".split("|");
|
||||||
//GET PHP categories
|
jQuery("#cat-search").autocomplete(categories);
|
||||||
var datacats = "<?php echo esc_js($cat_name); ?>".split("|");
|
|
||||||
|
|
||||||
//Set autocomplete
|
|
||||||
jQuery("#cat-search").autocomplete(datacats);
|
|
||||||
|
|
||||||
//Handle autocomplete result
|
|
||||||
jQuery("#cat-search").result(function(event, data, formatted) {
|
jQuery("#cat-search").result(function(event, data, formatted) {
|
||||||
jQuery('#existing-categories').css('display','block');
|
jQuery('#existing-categories').css('display','block');
|
||||||
jQuery("#existing-categories dt:contains('" + data + "')").css("display", "block");
|
jQuery("#existing-categories dt:contains('" + data + "')").css("display", "block");
|
||||||
|
|
||||||
jQuery('#show-cats').hide();
|
jQuery('#show-cats').hide();
|
||||||
jQuery('#hide-cats').show();
|
jQuery('#hide-cats').show();
|
||||||
|
|
||||||
});
|
});
|
||||||
jQuery('#existing-categories').css('display','none');
|
jQuery('#existing-categories').css('display','none');
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<input type="text" onfocus="jQuery('#cat-search').attr('value','');" id="cat-search" value="<?php esc_attr_e('Search Categories'); ?>" />
|
<input type="text" onfocus="jQuery('#cat-search').attr('value','');" id="cat-search" value="<?php esc_attr_e('Search Categories'); ?>" />
|
||||||
|
|
||||||
<a id="show-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','block');jQuery('#cat-search').attr('value','');jQuery('#existing-categories dt').css('display','block');jQuery('#show-cats').hide();jQuery('#hide-cats').show();">View All</a>
|
<a id="show-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','block');jQuery('#cat-search').attr('value','');jQuery('#existing-categories dt').css('display','block');jQuery('#show-cats').hide();jQuery('#hide-cats').show();"><?php _e('View All'); ?></a>
|
||||||
<a id="hide-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','none');jQuery('#cat-search').attr('value','Search Categories');jQuery('#existing-categories dt').css('display','none');jQuery('#show-cats').show();jQuery('#hide-cats').hide();">Hide All</a>
|
<a id="hide-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','none');jQuery('#cat-search').attr('value','Search Categories');jQuery('#existing-categories dt').css('display','none');jQuery('#show-cats').show();jQuery('#hide-cats').hide();"><?php _e('Hide All'); ?></a>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery('#hide-cats').hide();
|
jQuery('#hide-cats').hide();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul id="existing-categories" class="list">
|
<ul id="existing-categories" class="list">
|
||||||
<?php
|
<?php
|
||||||
// Get default Categories
|
$items_counter = wp_nav_menu_get_categories( $items_counter, 'default' );
|
||||||
$intCounter = wp_nav_menu_get_categories($intCounter, 'default');
|
?>
|
||||||
?>
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="fix"></div>
|
<div class="fix"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.widgets-holder-wrap -->
|
</div><!-- /.widgets-holder-wrap -->
|
||||||
|
|
||||||
|
@ -438,15 +359,15 @@ if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
|
||||||
<h3><?php esc_html_e('Add a Custom Url'); ?></h3>
|
<h3><?php esc_html_e('Add a Custom Url'); ?></h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="widget-holder">
|
<div class="widget-holder">
|
||||||
<input id="custom_menu_item_url" type="text" value="http://" />
|
<input id="custom-menu-item-url" type="text" value="http://" />
|
||||||
<label><?php _e('URL'); ?></label><br />
|
<label for="custom-menu-item-url"><?php _e('URL'); ?></label><br />
|
||||||
<?php $templatedir = get_bloginfo('url'); ?>
|
<?php $template_dir = get_bloginfo('url'); ?>
|
||||||
<input type="hidden" id="templatedir" value="<?php echo esc_attr($templatedir); ?>" />
|
<input type="hidden" id="template-dir" value="<?php echo esc_attr($template_dir); ?>" />
|
||||||
<input id="custom_menu_item_name" type="text" value="Menu Item" onfocus="jQuery('#custom_menu_item_name').attr('value','');" />
|
<input id="custom-menu-item-name" type="text" value="<?php echo esc_attr( __('Menu Item') ); ?>" onfocus="jQuery('#custom-menu-item-name').attr('value','');" />
|
||||||
<label><?php _e('Menu Text'); ?></label><br />
|
<label for="custom-menu-item-name"><?php _e('Menu Text'); ?></label><br />
|
||||||
<input id="custom_menu_item_description" type="text" value="<?php esc_attr_e('A description'); ?>" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> onfocus="jQuery('#custom_menu_item_description').attr('value','');" />
|
<input id="custom_menu_item_description" type="text" value="<?php esc_attr_e('A description'); ?>" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> onfocus="jQuery('#custom_menu_item_description').attr('value','');" />
|
||||||
<label <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> ><?php _e('Description'); ?></label>
|
<label <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> ><?php _e('Description'); ?></label>
|
||||||
<a class="addtomenu" onclick="appendToList('<?php echo $templatedir; ?>','Custom','','','','0','');jQuery('#custom_menu_item_name').attr('value','Menu Item');jQuery('#custom_menu_item_description').attr('value','A description');"><?php _e('Add to menu'); ?></a>
|
<a class="addtomenu" onclick="appendToList('<?php echo $template_dir; ?>','<?php echo esc_js( _x('Custom', 'menu nav item type') ); ?>','','','','0','');jQuery('#custom-menu-item-name').attr('value','<?php echo esc_js( __('Menu Item') ); ?>');jQuery('#custom_menu_item_description').attr('value','<?php echo esc_js( __('A description') ); ?>');"><?php _e('Add to menu'); ?></a>
|
||||||
<div class="fix"></div>
|
<div class="fix"></div>
|
||||||
</div>
|
</div>
|
||||||
</div><!-- /.widgets-holder-wrap -->
|
</div><!-- /.widgets-holder-wrap -->
|
||||||
|
@ -455,7 +376,7 @@ if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="dialog-confirm" style="display:none;" title="<?php esc_attr_e('Edit Menu Item'); ?>">
|
<div id="dialog-confirm" style="display:none;" title="<?php esc_attr_e('Edit Menu Item'); ?>">
|
||||||
</label><input id="edittitle" type="text" name="edittitle" value="" /><label class="editlabel" for="edittitle"><?php _e('Menu Title'); ?></label><br />
|
<input id="edittitle" type="text" name="edittitle" value="" /><label class="editlabel" for="edittitle"><?php _e('Menu Title'); ?></label><br />
|
||||||
<input id="editlink" type="text" name="editlink" value="" /><label class="editlabel" for="editlink"><?php _e('URL'); ?></label><br />
|
<input id="editlink" type="text" name="editlink" value="" /><label class="editlabel" for="editlink"><?php _e('URL'); ?></label><br />
|
||||||
<input id="editanchortitle" type="text" name="editanchortitle" value="" /><label class="editlabel" for="editanchortitle"><?php _e('Link Title'); ?></label><br />
|
<input id="editanchortitle" type="text" name="editanchortitle" value="" /><label class="editlabel" for="editanchortitle"><?php _e('Link Title'); ?></label><br />
|
||||||
<select id="editnewwindow" name="editnewwindow">
|
<select id="editnewwindow" name="editnewwindow">
|
||||||
|
|
|
@ -1120,18 +1120,8 @@ class WP_Widget_Tag_Cloud extends WP_Widget {
|
||||||
<ul class="custom-nav">
|
<ul class="custom-nav">
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
wp_nav_menu( array('id' => $navmenu, 'name' => $wp_custom_nav_menu_name, 'desc' => $navwidgetdescription, 'format' => 'widget') );
|
||||||
?>
|
//DEVELOPER settings enabled
|
||||||
|
|
||||||
<?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
|
|
||||||
if ( $navdeveloper == 'yes' ) {
|
if ( $navdeveloper == 'yes' ) {
|
||||||
//DISPLAY Custom UL
|
//DISPLAY Custom UL
|
||||||
if ( $navul == 'yes' ) {
|
if ( $navul == 'yes' ) {
|
||||||
|
|
|
@ -104,7 +104,7 @@ function wp_print_nav_menu_item($menu_item, $context, $args = array() ) {
|
||||||
<?php if ( 'backend' == $context ) { ?>
|
<?php if ( 'backend' == $context ) { ?>
|
||||||
<a><span class=""></span></a>
|
<a><span class=""></span></a>
|
||||||
<?php } else { ?>
|
<?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 } ?>
|
<?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="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 ) ); ?>" />
|
<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;
|
break;
|
||||||
|
|
||||||
case 'default':
|
case 'default':
|
||||||
$templatedir = get_bloginfo('url');
|
$template_dir = get_bloginfo('url');
|
||||||
?>
|
?>
|
||||||
<dl>
|
<dl>
|
||||||
<dt>
|
<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>
|
<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>
|
</dl>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,7 +25,7 @@ function wp_create_nav_menu( $menu_name ) {
|
||||||
$menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' );
|
$menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' );
|
||||||
|
|
||||||
if ( $menu_exists )
|
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' );
|
$menu = wp_insert_term( $menu_name, 'nav_menu' );
|
||||||
if ( is_wp_error($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 );
|
$menu_item->link = get_page_link( $menu_item->object_id );
|
||||||
|
|
||||||
if ( $menu_item->post_title == '' )
|
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
|
else
|
||||||
$menu_item->title = htmlentities( $menu_item->post_title );
|
$menu_item->title = $menu_item->post_title;
|
||||||
|
|
||||||
if ( $menu_item->post_content == '' )
|
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
|
else
|
||||||
$menu_item->description = htmlentities( $menu_item->post_content );
|
$menu_item->description = $menu_item->post_content;
|
||||||
$menu_item->target = '';
|
$menu_item->target = '';
|
||||||
$menu_item->append = 'Page';
|
$menu_item->append = _x('Page', 'menu nav item type');
|
||||||
break;
|
break;
|
||||||
// Category Menu Item
|
// Category Menu Item
|
||||||
case 'category':
|
case 'category':
|
||||||
|
@ -114,25 +114,25 @@ function wp_setup_nav_menu_item($menu_item, $type = 'item', $position = 0) {
|
||||||
|
|
||||||
if ( empty($menu_item->post_title) ) {
|
if ( empty($menu_item->post_title) ) {
|
||||||
$title_raw = get_category( $menu_item->object_id );
|
$title_raw = get_category( $menu_item->object_id );
|
||||||
$menu_item->title = htmlentities($title_raw->cat_name);
|
$menu_item->title = $title_raw->cat_name;
|
||||||
} else {
|
} else {
|
||||||
$menu_item->title = htmlentities( $menu_item->post_title );
|
$menu_item->title = $menu_item->post_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( empty($menu_item->post_content) )
|
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
|
else
|
||||||
$menu_item->description = htmlentities( $menu_item->post_content );
|
$menu_item->description = $menu_item->post_content;
|
||||||
$menu_item->target = '';
|
$menu_item->target = '';
|
||||||
$menu_item->append = 'Category';
|
$menu_item->append = _x('Category', 'menu nav item type');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Custom Menu Item
|
// Custom Menu Item
|
||||||
$menu_item->link = $menu_item->guid;
|
$menu_item->link = $menu_item->guid;
|
||||||
$menu_item->title = htmlentities( $menu_item->post_title );
|
$menu_item->title = $menu_item->post_title;
|
||||||
$menu_item->description = htmlentities( $menu_item->post_content );
|
$menu_item->description = $menu_item->post_content;
|
||||||
$menu_item->target = 'target="_blank"';
|
$menu_item->target = 'target="_blank"';
|
||||||
$menu_item->append = 'Custom';
|
$menu_item->append = _x('Custom', 'menu nav item type');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ function wp_setup_nav_menu_item($menu_item, $type = 'item', $position = 0) {
|
||||||
|
|
||||||
//SET anchor title
|
//SET anchor title
|
||||||
if (isset($wp_custom_nav_menu_items->custom_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 {
|
else {
|
||||||
$anchor_title = $title;
|
$anchor_title = $title;
|
||||||
|
|
|
@ -398,7 +398,13 @@ function wp_default_scripts( &$scripts ) {
|
||||||
|
|
||||||
// Custom Navigation
|
// Custom Navigation
|
||||||
$scripts->add( 'custom-navigation-default-items', "/wp-admin/js/custom-navigation-default-items$suffix.js", false, '20100223' );
|
$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' );
|
$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( '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( '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( '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 ) {
|
foreach ( $rtl_styles as $rtl_style ) {
|
||||||
$styles->add_data( $rtl_style, 'rtl', true );
|
$styles->add_data( $rtl_style, 'rtl', true );
|
||||||
|
|
Loading…
Reference in New Issue