71 ); |
71 ); |
72 |
72 |
73 $original_title = false; |
73 $original_title = false; |
74 if ( 'taxonomy' == $item->type ) { |
74 if ( 'taxonomy' == $item->type ) { |
75 $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); |
75 $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); |
76 if ( is_wp_error( $original_title ) ) |
76 if ( is_wp_error( $original_title ) ) { |
77 $original_title = false; |
77 $original_title = false; |
|
78 } |
78 } elseif ( 'post_type' == $item->type ) { |
79 } elseif ( 'post_type' == $item->type ) { |
79 $original_object = get_post( $item->object_id ); |
80 $original_object = get_post( $item->object_id ); |
80 $original_title = get_the_title( $original_object->ID ); |
81 $original_title = get_the_title( $original_object->ID ); |
81 } elseif ( 'post_type_archive' == $item->type ) { |
82 } elseif ( 'post_type_archive' == $item->type ) { |
82 $original_object = get_post_type_object( $item->object ); |
83 $original_object = get_post_type_object( $item->object ); |
83 if ( $original_object ) { |
84 if ( $original_object ) { |
84 $original_title = $original_object->labels->archives; |
85 $original_title = $original_object->labels->archives; |
85 } |
86 } |
86 } |
87 } |
87 |
88 |
88 $classes = array( |
89 $classes = array( |
89 'menu-item menu-item-depth-' . $depth, |
90 'menu-item menu-item-depth-' . $depth, |
90 'menu-item-' . esc_attr( $item->object ), |
91 'menu-item-' . esc_attr( $item->object ), |
91 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'), |
92 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive' ), |
92 ); |
93 ); |
93 |
94 |
94 $title = $item->title; |
95 $title = $item->title; |
95 |
96 |
96 if ( ! empty( $item->_invalid ) ) { |
97 if ( ! empty( $item->_invalid ) ) { |
98 /* translators: %s: title of menu item which is invalid */ |
99 /* translators: %s: title of menu item which is invalid */ |
99 $title = sprintf( __( '%s (Invalid)' ), $item->title ); |
100 $title = sprintf( __( '%s (Invalid)' ), $item->title ); |
100 } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { |
101 } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { |
101 $classes[] = 'pending'; |
102 $classes[] = 'pending'; |
102 /* translators: %s: title of menu item in draft status */ |
103 /* translators: %s: title of menu item in draft status */ |
103 $title = sprintf( __('%s (Pending)'), $item->title ); |
104 $title = sprintf( __( '%s (Pending)' ), $item->title ); |
104 } |
105 } |
105 |
106 |
106 $title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label; |
107 $title = ( ! isset( $item->label ) || '' == $item->label ) ? $title : $item->label; |
107 |
108 |
108 $submenu_text = ''; |
109 $submenu_text = ''; |
109 if ( 0 == $depth ) |
110 if ( 0 == $depth ) { |
110 $submenu_text = 'style="display: none;"'; |
111 $submenu_text = 'style="display: none;"'; |
|
112 } |
111 |
113 |
112 ?> |
114 ?> |
113 <li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode(' ', $classes ); ?>"> |
115 <li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode( ' ', $classes ); ?>"> |
114 <div class="menu-item-bar"> |
116 <div class="menu-item-bar"> |
115 <div class="menu-item-handle"> |
117 <div class="menu-item-handle"> |
116 <span class="item-title"><span class="menu-item-title"><?php echo esc_html( $title ); ?></span> <span class="is-submenu" <?php echo $submenu_text; ?>><?php _e( 'sub item' ); ?></span></span> |
118 <span class="item-title"><span class="menu-item-title"><?php echo esc_html( $title ); ?></span> <span class="is-submenu" <?php echo $submenu_text; ?>><?php _e( 'sub item' ); ?></span></span> |
117 <span class="item-controls"> |
119 <span class="item-controls"> |
118 <span class="item-type"><?php echo esc_html( $item->type_label ); ?></span> |
120 <span class="item-type"><?php echo esc_html( $item->type_label ); ?></span> |
119 <span class="item-order hide-if-js"> |
121 <span class="item-order hide-if-js"> |
120 <a href="<?php |
122 <a href=" |
|
123 <?php |
121 echo wp_nonce_url( |
124 echo wp_nonce_url( |
122 add_query_arg( |
125 add_query_arg( |
123 array( |
126 array( |
124 'action' => 'move-up-menu-item', |
127 'action' => 'move-up-menu-item', |
125 'menu-item' => $item_id, |
128 'menu-item' => $item_id, |
126 ), |
129 ), |
127 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) |
130 remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) |
128 ), |
131 ), |
129 'move-menu_item' |
132 'move-menu_item' |
130 ); |
133 ); |
131 ?>" class="item-move-up" aria-label="<?php esc_attr_e( 'Move up' ) ?>">↑</a> |
134 ?> |
|
135 " class="item-move-up" aria-label="<?php esc_attr_e( 'Move up' ); ?>">↑</a> |
132 | |
136 | |
133 <a href="<?php |
137 <a href=" |
|
138 <?php |
134 echo wp_nonce_url( |
139 echo wp_nonce_url( |
135 add_query_arg( |
140 add_query_arg( |
136 array( |
141 array( |
137 'action' => 'move-down-menu-item', |
142 'action' => 'move-down-menu-item', |
138 'menu-item' => $item_id, |
143 'menu-item' => $item_id, |
139 ), |
144 ), |
140 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) ) |
145 remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) |
141 ), |
146 ), |
142 'move-menu_item' |
147 'move-menu_item' |
143 ); |
148 ); |
144 ?>" class="item-move-down" aria-label="<?php esc_attr_e( 'Move down' ) ?>">↓</a> |
149 ?> |
|
150 " class="item-move-down" aria-label="<?php esc_attr_e( 'Move down' ); ?>">↓</a> |
145 </span> |
151 </span> |
146 <a class="item-edit" id="edit-<?php echo $item_id; ?>" href="<?php |
152 <a class="item-edit" id="edit-<?php echo $item_id; ?>" href=" |
147 echo ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) ); |
153 <?php |
148 ?>" aria-label="<?php esc_attr_e( 'Edit menu item' ); ?>"><span class="screen-reader-text"><?php _e( 'Edit' ); ?></span></a> |
154 echo ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) ); |
|
155 ?> |
|
156 " aria-label="<?php esc_attr_e( 'Edit menu item' ); ?>"><span class="screen-reader-text"><?php _e( 'Edit' ); ?></span></a> |
149 </span> |
157 </span> |
150 </div> |
158 </div> |
151 </div> |
159 </div> |
152 |
160 |
153 <div class="menu-item-settings wp-clearfix" id="menu-item-settings-<?php echo $item_id; ?>"> |
161 <div class="menu-item-settings wp-clearfix" id="menu-item-settings-<?php echo $item_id; ?>"> |
178 </label> |
186 </label> |
179 </p> |
187 </p> |
180 <p class="field-css-classes description description-thin"> |
188 <p class="field-css-classes description description-thin"> |
181 <label for="edit-menu-item-classes-<?php echo $item_id; ?>"> |
189 <label for="edit-menu-item-classes-<?php echo $item_id; ?>"> |
182 <?php _e( 'CSS Classes (optional)' ); ?><br /> |
190 <?php _e( 'CSS Classes (optional)' ); ?><br /> |
183 <input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode(' ', $item->classes ) ); ?>" /> |
191 <input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode( ' ', $item->classes ) ); ?>" /> |
184 </label> |
192 </label> |
185 </p> |
193 </p> |
186 <p class="field-xfn description description-thin"> |
194 <p class="field-xfn description description-thin"> |
187 <label for="edit-menu-item-xfn-<?php echo $item_id; ?>"> |
195 <label for="edit-menu-item-xfn-<?php echo $item_id; ?>"> |
188 <?php _e( 'Link Relationship (XFN)' ); ?><br /> |
196 <?php _e( 'Link Relationship (XFN)' ); ?><br /> |
191 </p> |
199 </p> |
192 <p class="field-description description description-wide"> |
200 <p class="field-description description description-wide"> |
193 <label for="edit-menu-item-description-<?php echo $item_id; ?>"> |
201 <label for="edit-menu-item-description-<?php echo $item_id; ?>"> |
194 <?php _e( 'Description' ); ?><br /> |
202 <?php _e( 'Description' ); ?><br /> |
195 <textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $item->description ); // textarea_escaped ?></textarea> |
203 <textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $item->description ); // textarea_escaped ?></textarea> |
196 <span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?></span> |
204 <span class="description"><?php _e( 'The description will be displayed in the menu if the current theme supports it.' ); ?></span> |
197 </label> |
205 </label> |
198 </p> |
206 </p> |
199 |
207 |
200 <fieldset class="field-move hide-if-no-js description description-wide"> |
208 <fieldset class="field-move hide-if-no-js description description-wide"> |
201 <span class="field-move-visual-label" aria-hidden="true"><?php _e( 'Move' ); ?></span> |
209 <span class="field-move-visual-label" aria-hidden="true"><?php _e( 'Move' ); ?></span> |
207 </fieldset> |
215 </fieldset> |
208 |
216 |
209 <div class="menu-item-actions description-wide submitbox"> |
217 <div class="menu-item-actions description-wide submitbox"> |
210 <?php if ( 'custom' != $item->type && $original_title !== false ) : ?> |
218 <?php if ( 'custom' != $item->type && $original_title !== false ) : ?> |
211 <p class="link-to-original"> |
219 <p class="link-to-original"> |
212 <?php printf( __('Original: %s'), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); ?> |
220 <?php |
|
221 /* translators: %s: original title */ |
|
222 printf( __( 'Original: %s' ), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); |
|
223 ?> |
213 </p> |
224 </p> |
214 <?php endif; ?> |
225 <?php endif; ?> |
215 <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="<?php |
226 <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href=" |
216 echo wp_nonce_url( |
227 <?php |
|
228 echo wp_nonce_url( |
|
229 add_query_arg( |
|
230 array( |
|
231 'action' => 'delete-menu-item', |
|
232 'menu-item' => $item_id, |
|
233 ), |
|
234 admin_url( 'nav-menus.php' ) |
|
235 ), |
|
236 'delete-menu_item_' . $item_id |
|
237 ); |
|
238 ?> |
|
239 "><?php _e( 'Remove' ); ?></a> <span class="meta-sep hide-if-no-js"> | </span> <a class="item-cancel submitcancel hide-if-no-js" id="cancel-<?php echo $item_id; ?>" href=" |
|
240 <?php |
|
241 echo esc_url( |
217 add_query_arg( |
242 add_query_arg( |
218 array( |
243 array( |
219 'action' => 'delete-menu-item', |
244 'edit-menu-item' => $item_id, |
220 'menu-item' => $item_id, |
245 'cancel' => time(), |
221 ), |
246 ), |
222 admin_url( 'nav-menus.php' ) |
247 admin_url( 'nav-menus.php' ) |
223 ), |
248 ) |
224 'delete-menu_item_' . $item_id |
249 ); |
225 ); ?>"><?php _e( 'Remove' ); ?></a> <span class="meta-sep hide-if-no-js"> | </span> <a class="item-cancel submitcancel hide-if-no-js" id="cancel-<?php echo $item_id; ?>" href="<?php echo esc_url( add_query_arg( array( 'edit-menu-item' => $item_id, 'cancel' => time() ), admin_url( 'nav-menus.php' ) ) ); |
250 ?> |
226 ?>#menu-item-settings-<?php echo $item_id; ?>"><?php _e('Cancel'); ?></a> |
251 #menu-item-settings-<?php echo $item_id; ?>"><?php _e( 'Cancel' ); ?></a> |
227 </div> |
252 </div> |
228 |
253 |
229 <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" /> |
254 <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" /> |
230 <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object_id ); ?>" /> |
255 <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object_id ); ?>" /> |
231 <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object ); ?>" /> |
256 <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object ); ?>" /> |