function store_seo_info() { if (get_post_type() == 'store' && !is_singular()) { $id = get_queried_object_id(); if ((taxonomy_exists('products_category') || taxonomy_exists('products_tag')) && $id != 0) { $term_name = get_term_field('name', $id, 'products_category'); $title = $term_name; $paged = get_query_var('paged'); if ($paged > 1) { $title .= sprintf(__(' - 第 %s 页 ', 'tinection'), $paged); } $title .= ' - ' . get_bloginfo('name') . '商城'; $keywords = $term_name . ",商城"; $description = strip_tags(term_description()); } elseif (is_archive() && $id == 0) { $title = ot_get_option('shop_archives_title', 'WordPress商店'); $paged = get_query_var('paged'); if ($paged > 1) { $title .= sprintf(__(' - 第 %s 页 ', 'tinection'), $paged); } $title .= ' - ' . get_bloginfo('name'); $keywords = '商品归档,商城,归档'; $description = get_bloginfo('name') . '商城'; } $seo_text = '<title>' . $title . '</title><meta name="description" content="' . $description . '" /><meta name="keywords" content="' . $keywords . '" />'; } else { $seo_text = ''; } return $seo_text; }
public static function get_the_term($taxonomy, $b = '', $a = '', $f = FALSE, $args = array()) { self::__dep(); global $post; if (!self::is_active()) { return; } $args = wp_parse_args($args, array('id' => $post->ID, 'echo' => TRUE, 'def' => '', 'sep' => ', ', 'class' => 'term')); $html = ''; $terms = get_the_terms($args['id'], $taxonomy); if ($terms && !is_wp_error($terms)) { foreach ($terms as $term) { $desc = get_term_field('description', $term->term_id, $term->taxonomy); //$desc = is_wp_error( $desc ) ? '' : wpautop( $desc, FALSE ); $desc = is_wp_error($desc) ? '' : strip_tags($desc); $html .= '<a href="' . get_term_link($term, $taxonomy) . '" title="' . esc_attr($desc) . '" class="' . $args['class'] . '" >' . $term->name . '</a>' . $args['sep']; } if (!empty($html)) { if (isset($args['echo']) && $args['echo']) { echo $b . rtrim($html, $args['sep']) . $a; return; } return $b . rtrim($html, $args['sep']) . $a; } } if (isset($args['def']) && $args['def']) { if (isset($args['echo']) && $args['echo']) { echo $args['def']; return; } return $args['def']; } }
/** * @ticket 34245 */ public function test_get_term_field_invalid_term_should_return_WP_Error() { $found = get_term_field('taxonomy', 0, $this->taxonomy); $this->assertWPError($found); $this->assertSame('invalid_term', $found->get_error_code()); $_found = get_term_field('taxonomy', 0); $this->assertWPError($_found); $this->assertSame('invalid_term', $_found->get_error_code()); }
/** * @see Walker::start_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param object $args */ function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0) { global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; $item = $object; $indent = $depth ? str_repeat("\t", $depth) : ''; ob_start(); // $item_id = esc_attr( $item->ID ); $removed_args = array('action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce'); $original_title = ''; if ('taxonomy' == $item->type) { $original_title = get_term_field('name', $item->object_id, $item->object, 'raw'); if (is_wp_error($original_title)) { $original_title = false; } } elseif ('post_type' == $item->type) { $original_object = get_post($item->object_id); $original_title = $original_object->post_title; } $item_id = esc_attr($item->ID); $classes = array('menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr($item->object), 'menu-item-edit-' . (isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ? 'active' : 'inactive')); $title = $item->title; if (!empty($item->_invalid)) { $classes[] = 'menu-item-invalid'; /* translators: %s: title of menu item which is invalid */ $title = sprintf(__('%s (Invalid)'), $item->title); } elseif (isset($item->post_status) && 'draft' == $item->post_status) { $classes[] = 'pending'; /* translators: %s: title of menu item in draft status */ $title = sprintf(__('%s (Pending)'), $item->title); } $title = !isset($item->label) || '' == $item->label ? $title : $item->label; $submenu_text = ''; if (0 == $depth) { $submenu_text = 'style="display: none;"'; } $megamenu_title = $item->megamenuActive == "active" ? '<span class="is-submenu">mega menu</span>' : ''; switch ($item->url) { case '#MegaMenuColumn': $item->type_label = 'Column'; $this->doColumnTemplate($output, $item, $depth, $args, $item_id, $classes, $title, $megamenu_title, $submenu_text, $removed_args, $original_title); break; case '#MegaMenuHeading': $item->type_label = 'Heading'; $this->doHeadingTemplate($output, $item, $depth, $args, $item_id, $classes, $title, $megamenu_title, $submenu_text, $removed_args, $original_title); break; case '#MegaMenuContent': $item->type_label = 'Content'; $this->doContentTemplate($output, $item, $depth, $args, $item_id, $classes, $title, $megamenu_title, $submenu_text, $removed_args, $original_title); break; default: $this->doDefaultTemplate($output, $item, $depth, $args, $item_id, $classes, $title, $megamenu_title, $submenu_text, $removed_args, $original_title); break; } $output .= ob_get_clean(); }
/** * Adds custom nav menu item classes. * * @since 0.1.0 * @access public * @param array $classes * @param object $item * @param object $args */ function socially_awkward_nav_menu_css_class($classes, $item, $args) { if ('formats' === $args->theme_location && 'taxonomy' === $item->type && 'post_format' === $item->object) { $classes[] = 'menu-item-' . hybrid_clean_post_format_slug(get_term_field('slug', $item->object_id, $item->object, 'attribute')); } if ('post_type' === $item->type && 'page' === $item->object && $item->object_id == get_option('page_for_posts')) { $classes[] = 'menu-item-blog'; } return $classes; }
function wds_replace_vars($string, $args) { global $wp_query; $defaults = array('ID' => '', 'name' => '', 'post_author' => '', 'post_content' => '', 'post_date' => '', 'post_excerpt' => '', 'post_modified' => '', 'post_title' => '', 'taxonomy' => '', 'description' => '', 'username' => '', 'full_name' => ''); $pagenum = get_query_var('paged'); if ($pagenum === 0) { $pagenum = $wp_query->max_num_pages > 1 ? 1 : ''; } $r = wp_parse_args($args, $defaults); $replacements = array('%%date%%' => $r['post_date'], '%%title%%' => stripslashes($r['post_title']), '%%sitename%%' => get_bloginfo('name'), '%%sitedesc%%' => get_bloginfo('description'), '%%excerpt%%' => wds_get_trimmed_excerpt($r['post_excerpt'], $r['post_content']), '%%excerpt_only%%' => $r['post_excerpt'], '%%category%%' => get_the_category_list('', '', $r['ID']) != '' ? get_the_category_list('', '', $r['ID']) : $r['name'], '%%category_description%%' => !empty($r['taxonomy']) ? trim(strip_tags(get_term_field('description', $r['term_id'], $r['taxonomy']))) : '', '%%tag_description%%' => !empty($r['taxonomy']) ? trim(strip_tags(get_term_field('description', $r['term_id'], $r['taxonomy']))) : '', '%%term_description%%' => !empty($r['taxonomy']) ? trim(strip_tags(get_term_field('description', $r['term_id'], $r['taxonomy']))) : '', '%%term_title%%' => $r['name'], '%%tag%%' => $r['name'], '%%modified%%' => $r['post_modified'], '%%id%%' => $r['ID'], '%%name%%' => get_the_author_meta('display_name', !empty($r['post_author']) ? $r['post_author'] : get_query_var('author')), '%%userid%%' => !empty($r['post_author']) ? $r['post_author'] : get_query_var('author'), '%%searchphrase%%' => esc_html(get_query_var('s')), '%%currenttime%%' => date('H:i'), '%%currentdate%%' => date('M jS Y'), '%%currentmonth%%' => date('F'), '%%currentyear%%' => date('Y'), '%%page%%' => get_query_var('paged') != 0 ? 'Page ' . get_query_var('paged') . ' of ' . $wp_query->max_num_pages : '', '%%spell_page%%' => get_query_var('paged') != 0 ? 'Page ' . wds_spell_number(get_query_var('paged')) . ' of ' . wds_spell_number($wp_query->max_num_pages) : '', '%%pagetotal%%' => $wp_query->max_num_pages > 1 ? $wp_query->max_num_pages : '', '%%spell_pagetotal%%' => $wp_query->max_num_pages > 1 ? wds_spell_number($wp_query->max_num_pages) : '', '%%pagenumber%%' => $pagenum, '%%spell_pagenumber%%' => wds_spell_number($pagenum), '%%caption%%' => $r['post_excerpt'], '%%bp_group_name%%' => $r['name'], '%%bp_group_description%%' => wds_get_trimmed_excerpt('', $r['description']), '%%bp_user_username%%' => $r['username'], '%%bp_user_full_name%%' => $r['full_name']); foreach ($replacements as $var => $repl) { $repl = apply_filters('wds-macro-variable_replacement', $repl, $var); $string = str_replace($var, $repl, $string); } return $string; }
/** * Filters `get_the_archve_description` to add better archive descriptions than core. * * @since 1.0.0 * * @param string $desc * @return string */ function munsa_lite_archive_description_filter($desc) { if (is_home() && !is_front_page()) { $desc = get_post_field('post_content', get_queried_object_id(), 'raw'); } elseif (is_category()) { $desc = get_term_field('description', get_queried_object_id(), 'category', 'raw'); } elseif (is_tag()) { $desc = get_term_field('description', get_queried_object_id(), 'post_tag', 'raw'); } elseif (is_tax()) { $desc = get_term_field('description', get_queried_object_id(), get_query_var('taxonomy'), 'raw'); } elseif (is_author()) { $desc = get_the_author_meta('description', get_query_var('author')); } elseif (is_post_type_archive()) { $desc = get_post_type_object(get_query_var('post_type'))->description; } return apply_filters('munsa_lite_archive_description', $desc); }
function link_cat_row($category) { global $class; if (current_user_can('manage_categories')) { $edit = "<a href='link-category.php?action=edit&cat_ID={$category->term_id}' class='edit'>" . __('Edit') . "</a></td>"; $default_cat_id = (int) get_option('default_link_category'); if ($category->term_id != $default_cat_id) { $edit .= "<td><a href='" . wp_nonce_url("link-category.php?action=delete&cat_ID={$category->term_id}", 'delete-link-category_' . $category->term_id) . "' onclick=\"return deleteSomething( 'cat', {$category->term_id}, '" . js_escape(sprintf(__("You are about to delete the category '%s'.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop."), $category->name, get_term_field('name', $default_cat_id, 'link_category'))) . "' );\" class='delete'>" . __('Delete') . "</a>"; } else { $edit .= "<td style='text-align:center'>" . __("Default"); } } else { $edit = ''; } $class = defined('DOING_AJAX') && DOING_AJAX || " class='alternate'" == $class ? '' : " class='alternate'"; $category->count = number_format_i18n($category->count); $count = $category->count > 0 ? "<a href='link-manager.php?cat_id={$category->term_id}'>{$category->count}</a>" : $category->count; return "<tr id='cat-{$category->term_id}'{$class}>\n\t\t<th scope='row' style='text-align: center'>{$category->term_id}</th>\n\t\t<td>" . ($name_override ? $name_override : $pad . ' ' . $category->name) . "</td>\n\t\t<td>{$category->description}</td>\n\t\t<td align='center'>{$count}</td>\n\t\t<td>{$edit}</td>\n\t</tr>\n"; }
/** * Retrieve term description. * * @since 2.8.0 * * @param int $term Optional. Term ID. Will use global term ID by default. * @param string $taxonomy Optional taxonomy name. Defaults to 'post_tag'. * @return string Term description, available. */ function term_description($term = 0, $taxonomy = 'post_tag') { if (!$term && (is_tax() || is_tag() || is_category())) { $term = get_queried_object(); if ($term) { $taxonomy = $term->taxonomy; $term = $term->term_id; } } $description = get_term_field('description', $term, $taxonomy); return is_wp_error($description) ? '' : $description; }
function woo_shortcode_post_categories($atts) { $defaults = array('sep' => ', ', 'before' => '', 'after' => '', 'taxonomy' => 'category'); $atts = shortcode_atts($defaults, $atts); $atts = array_map('wp_kses_post', $atts); $terms = get_the_terms(get_the_ID(), esc_html($atts['taxonomy'])); $cats = ''; if (is_array($terms) && 0 < count($terms)) { $links_array = array(); foreach ($terms as $k => $v) { $term_name = get_term_field('name', $v->term_id, $atts['taxonomy']); $links_array[] = '<a href="' . esc_url(get_term_link($v, $atts['taxonomy'])) . '" title="' . esc_attr(sprintf(__('View all items in %s', 'woothemes'), $term_name)) . '">' . esc_html($term_name) . '</a>'; } $cats = join($atts['sep'], $links_array); } $output = sprintf('<span class="categories">%2$s%1$s%3$s</span> ', $cats, $atts['before'], $atts['after']); return apply_filters('woo_shortcode_post_categories', $output, $atts); }
/** * @see Walker::start_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param object $args */ function start_el(&$output, $item, $depth, $args) { global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; $indent = $depth ? str_repeat("\t", $depth) : ''; ob_start(); $item_id = esc_attr($item->ID); $removed_args = array('action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce'); $original_title = ''; if ('taxonomy' == $item->type) { $original_title = get_term_field('name', $item->object_id, $item->object, 'raw'); if (is_wp_error($original_title)) { $original_title = false; } } elseif ('post_type' == $item->type) { $original_object = get_post($item->object_id); $original_title = $original_object->post_title; } $classes = array('menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr($item->object), 'menu-item-edit-' . (isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ? 'active' : 'inactive')); $title = $item->title; if (!empty($item->_invalid)) { $classes[] = 'menu-item-invalid'; /* translators: %s: title of menu item which is invalid */ $title = sprintf(__('%s (Invalid)'), $item->title); } elseif (isset($item->post_status) && 'draft' == $item->post_status) { $classes[] = 'pending'; /* translators: %s: title of menu item in draft status */ $title = sprintf(__('%s (Pending)'), $item->title); } $title = empty($item->label) ? $title : $item->label; ?> <li id="menu-item-<?php echo $item_id; ?> " class="<?php echo implode(' ', $classes); ?> "> <dl class="menu-item-bar"> <dt class="menu-item-handle"> <span class="item-title"><?php echo esc_html($title); ?> </span> <span class="item-controls"> <span class="item-type"><?php echo esc_html($item->type_label); ?> </span> <span class="item-order"> <a href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'move-up-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'); ?> " class="item-move-up"><abbr title="<?php esc_attr_e('Move up'); ?> ">↑</abbr></a> | <a href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'move-down-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'); ?> " class="item-move-down"><abbr title="<?php esc_attr_e('Move down'); ?> ">↓</abbr></a> </span> <a class="item-edit" id="edit-<?php echo $item_id; ?> " title="<?php _e('Edit Menu Item'); ?> " href="<?php 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))); ?> "><?php _e('Edit Menu Item'); ?> </a> </span> </dt> </dl> <div class="menu-item-settings" id="menu-item-settings-<?php echo $item_id; ?> "> <?php if ('custom' == $item->type) { ?> <p class="field-url description description-wide"> <label for="edit-menu-item-url-<?php echo $item_id; ?> "> <?php _e('URL'); ?> <br /> <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?> " class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->url); ?> " /> </label> </p> <?php } ?> <p class="description description-thin"> <label for="edit-menu-item-title-<?php echo $item_id; ?> "> <?php _e('Navigation Label'); ?> <br /> <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?> " class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->title); ?> " /> </label> </p> <p class="description description-thin"> <label for="edit-menu-item-attr-title-<?php echo $item_id; ?> "> <?php _e('Title Attribute'); ?> <br /> <input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?> " class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->post_excerpt); ?> " /> </label> </p> <p class="field-link-target description description-thin"> <label for="edit-menu-item-target-<?php echo $item_id; ?> "> <?php _e('Link Target'); ?> <br /> <select id="edit-menu-item-target-<?php echo $item_id; ?> " class="widefat edit-menu-item-target" name="menu-item-target[<?php echo $item_id; ?> ]"> <option value="" <?php selected($item->target, ''); ?> ><?php _e('Same window or tab'); ?> </option> <option value="_blank" <?php selected($item->target, '_blank'); ?> ><?php _e('New window or tab'); ?> </option> </select> </label> </p> <p class="field-css-classes description description-thin"> <label for="edit-menu-item-classes-<?php echo $item_id; ?> "> <?php _e('CSS Classes (optional)'); ?> <br /> <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)); ?> " /> </label> </p> <p class="field-xfn description description-thin"> <label for="edit-menu-item-xfn-<?php echo $item_id; ?> "> <?php _e('Link Relationship (XFN)'); ?> <br /> <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?> " class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->xfn); ?> " /> </label> </p> <p class="field-description description description-wide"> <label for="edit-menu-item-description-<?php echo $item_id; ?> "> <?php _e('Description'); ?> <br /> <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> <span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?> </span> </label> </p> <div class="menu-item-actions description-wide submitbox"> <?php if ('custom' != $item->type && $original_title !== false) { ?> <p class="link-to-original"> <?php printf(__('Original: %s'), '<a href="' . esc_attr($item->url) . '">' . esc_html($original_title) . '</a>'); ?> </p> <?php } ?> <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?> " href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'delete-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'delete-menu_item_' . $item_id); ?> "><?php _e('Remove'); ?> </a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php echo $item_id; ?> " href="<?php echo esc_url(add_query_arg(array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg($removed_args, admin_url('nav-menus.php')))); ?> #menu-item-settings-<?php echo $item_id; ?> "><?php _e('Cancel'); ?> </a> </div> <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?> ]" value="<?php echo $item_id; ?> " /> <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); ?> " /> <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->object); ?> " /> <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->menu_item_parent); ?> " /> <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->menu_order); ?> " /> <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->type); ?> " /> </div><!-- .menu-item-settings--> <ul class="menu-item-transport"></ul> <?php $output .= ob_get_clean(); }
/** * Decorates a menu item object with the shared navigation menu item properties. * * Properties: * - db_id: The DB ID of this item as a nav_menu_item object, if it exists (0 if it doesn't exist). * - object_id: The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories. * - type: The family of objects originally represented, such as "post_type" or "taxonomy." * - object: The type of object originally represented, such as "category," "post", or "attachment." * - type_label: The singular label used to describe this type of menu item. * - post_parent: The DB ID of the original object's parent object, if any (0 otherwise). * - menu_item_parent: The DB ID of the nav_menu_item that is this item's menu parent, if any. 0 otherwise. * - url: The URL to which this menu item points. * - title: The title of this menu item. * - target: The target attribute of the link element for this menu item. * - attr_title: The title attribute of the link element for this menu item. * - classes: The array of class attribute values for the link element of this menu item. * - xfn: The XFN relationship expressed in the link of this menu item. * - description: The description of this menu item. * * @since 3.0.0 * * @param object $menu_item The menu item to modify. * @return object $menu_item The menu item with standard menu item properties. */ function wp_setup_nav_menu_item($menu_item) { if (isset($menu_item->post_type)) { if ('nav_menu_item' == $menu_item->post_type) { $menu_item->db_id = (int) $menu_item->ID; $menu_item->menu_item_parent = empty($menu_item->menu_item_parent) ? get_post_meta($menu_item->ID, '_menu_item_menu_item_parent', true) : $menu_item->menu_item_parent; $menu_item->object_id = empty($menu_item->object_id) ? get_post_meta($menu_item->ID, '_menu_item_object_id', true) : $menu_item->object_id; $menu_item->object = empty($menu_item->object) ? get_post_meta($menu_item->ID, '_menu_item_object', true) : $menu_item->object; $menu_item->type = empty($menu_item->type) ? get_post_meta($menu_item->ID, '_menu_item_type', true) : $menu_item->type; if ('post_type' == $menu_item->type) { $object = get_post_type_object($menu_item->object); if ($object) { $menu_item->type_label = $object->labels->singular_name; } else { $menu_item->type_label = $menu_item->object; $menu_item->_invalid = true; } $menu_item->url = get_permalink($menu_item->object_id); $original_object = get_post($menu_item->object_id); $original_title = $original_object->post_title; $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; } elseif ('taxonomy' == $menu_item->type) { $object = get_taxonomy($menu_item->object); if ($object) { $menu_item->type_label = $object->labels->singular_name; } else { $menu_item->type_label = $menu_item->object; $menu_item->_invalid = true; } $term_url = get_term_link((int) $menu_item->object_id, $menu_item->object); $menu_item->url = !is_wp_error($term_url) ? $term_url : ''; $original_title = get_term_field('name', $menu_item->object_id, $menu_item->object, 'raw'); if (is_wp_error($original_title)) { $original_title = false; } $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; } else { $menu_item->type_label = __('Custom'); $menu_item->title = $menu_item->post_title; $menu_item->url = empty($menu_item->url) ? get_post_meta($menu_item->ID, '_menu_item_url', true) : $menu_item->url; } $menu_item->target = empty($menu_item->target) ? get_post_meta($menu_item->ID, '_menu_item_target', true) : $menu_item->target; $menu_item->attr_title = empty($menu_item->attr_title) ? apply_filters('nav_menu_attr_title', $menu_item->post_excerpt) : $menu_item->attr_title; if (empty($menu_item->description)) { $menu_item->description = apply_filters('nav_menu_description', wp_trim_words($menu_item->post_content, 200)); } $menu_item->classes = empty($menu_item->classes) ? (array) get_post_meta($menu_item->ID, '_menu_item_classes', true) : $menu_item->classes; $menu_item->xfn = empty($menu_item->xfn) ? get_post_meta($menu_item->ID, '_menu_item_xfn', true) : $menu_item->xfn; } else { $menu_item->db_id = 0; $menu_item->menu_item_parent = 0; $menu_item->object_id = (int) $menu_item->ID; $menu_item->type = 'post_type'; $object = get_post_type_object($menu_item->post_type); $menu_item->object = $object->name; $menu_item->type_label = $object->labels->singular_name; $menu_item->title = $menu_item->post_title; $menu_item->url = get_permalink($menu_item->ID); $menu_item->target = ''; $menu_item->attr_title = apply_filters('nav_menu_attr_title', ''); $menu_item->description = apply_filters('nav_menu_description', ''); $menu_item->classes = array(); $menu_item->xfn = ''; } } elseif (isset($menu_item->taxonomy)) { $menu_item->ID = $menu_item->term_id; $menu_item->db_id = 0; $menu_item->menu_item_parent = 0; $menu_item->object_id = (int) $menu_item->term_id; $menu_item->post_parent = (int) $menu_item->parent; $menu_item->type = 'taxonomy'; $object = get_taxonomy($menu_item->taxonomy); $menu_item->object = $object->name; $menu_item->type_label = $object->labels->singular_name; $menu_item->title = $menu_item->name; $menu_item->url = get_term_link($menu_item, $menu_item->taxonomy); $menu_item->target = ''; $menu_item->attr_title = ''; $menu_item->description = get_term_field('description', $menu_item->term_id, $menu_item->taxonomy); $menu_item->classes = array(); $menu_item->xfn = ''; } return apply_filters('wp_setup_nav_menu_item', $menu_item); }
public function test_get_term_field_parent() { $parent = self::factory()->term->create_and_get(array('taxonomy' => $this->taxonomy)); $term = self::factory()->term->create_and_get(array('taxonomy' => $this->taxonomy, 'parent' => $parent->term_id)); $this->assertSame($parent->term_id, get_term_field('parent', $term)); $this->assertSame($parent->term_id, get_term_field('parent', $term->data)); $this->assertSame($parent->term_id, get_term_field('parent', $term->term_id)); }
/** * @since 2.2.1 */ protected function get_term_field($field, $term_id, $taxonomy) { $term_field = get_term_field($field, $term_id, $taxonomy, 'display'); if (is_wp_error($term_field)) { return false; } return $term_field; }
/** * @param string $string the string to replace the variables in. * @param array $args the object some of the replacement values might come from, could be a post, taxonomy or term. * @param array $omit variables that should not be replaced by this function. * @return string */ function wpseo_replace_vars( $string, $args, $omit = array() ) { $args = (array) $args; $string = strip_tags( $string ); // Let's see if we can bail super early. if ( strpos( $string, '%%' ) === false ) { return trim( preg_replace( '`\s+`u', ' ', $string ) ); } global $sep; if ( ! isset( $sep ) || empty( $sep ) ) { $sep = '-'; } $simple_replacements = array( '%%sep%%' => $sep, '%%sitename%%' => get_bloginfo( 'name' ), '%%sitedesc%%' => get_bloginfo( 'description' ), '%%currenttime%%' => date( get_option( 'time_format' ) ), '%%currentdate%%' => date( get_option( 'date_format' ) ), '%%currentday%%' => date( 'j' ), '%%currentmonth%%' => date( 'F' ), '%%currentyear%%' => date( 'Y' ), ); foreach ( $simple_replacements as $var => $repl ) { $string = str_replace( $var, $repl, $string ); } // Let's see if we can bail early. if ( strpos( $string, '%%' ) === false ) { return trim( preg_replace( '`\s+`u', ' ', $string ) ); } global $wp_query; $defaults = array( 'ID' => '', 'name' => '', 'post_author' => '', 'post_content' => '', 'post_date' => '', 'post_excerpt' => '', 'post_modified' => '', 'post_title' => '', 'taxonomy' => '', 'term_id' => '', 'term404' => '', ); if ( isset( $args['post_content'] ) ) { $args['post_content'] = wpseo_strip_shortcode( $args['post_content'] ); } if ( isset( $args['post_excerpt'] ) ) { $args['post_excerpt'] = wpseo_strip_shortcode( $args['post_excerpt'] ); } $r = (object) wp_parse_args( $args, $defaults ); $max_num_pages = 1; if ( ! is_singular() ) { $pagenum = get_query_var( 'paged' ); if ( $pagenum === 0 ) { $pagenum = 1; } if ( isset( $wp_query->max_num_pages ) && $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0 ) { $max_num_pages = $wp_query->max_num_pages; } } else { global $post; $pagenum = get_query_var( 'page' ); $max_num_pages = ( isset( $post->post_content ) ) ? substr_count( $post->post_content, '<!--nextpage-->' ) : 1; if ( $max_num_pages >= 1 ) { $max_num_pages++; } } // Let's do date first as it's a bit more work to get right. if ( $r->post_date != '' ) { $date = mysql2date( get_option( 'date_format' ), $r->post_date ); } else { if ( get_query_var( 'day' ) && get_query_var( 'day' ) != '' ) { $date = get_the_date(); } else { if ( single_month_title( ' ', false ) && single_month_title( ' ', false ) != '' ) { $date = single_month_title( ' ', false ); } elseif ( get_query_var( 'year' ) != '' ) { $date = get_query_var( 'year' ); } else { $date = ''; } } } $replacements = array( '%%date%%' => $date, '%%searchphrase%%' => esc_html( get_query_var( 's' ) ), '%%page%%' => ( $max_num_pages > 1 && $pagenum > 1 ) ? sprintf( $sep . ' ' . __( 'Page %d of %d', 'wordpress-seo' ), $pagenum, $max_num_pages ) : '', '%%pagetotal%%' => $max_num_pages, '%%pagenumber%%' => $pagenum, '%%term404%%' => sanitize_text_field( str_replace( '-', ' ', $r->term404 ) ), ); if ( isset( $r->ID ) ) { $replacements = array_merge( $replacements, array( '%%caption%%' => $r->post_excerpt, '%%category%%' => wpseo_get_terms( $r->ID, 'category' ), '%%excerpt%%' => ( ! empty( $r->post_excerpt ) ) ? strip_tags( $r->post_excerpt ) : wp_html_excerpt( strip_shortcodes( $r->post_content ),155 ), '%%excerpt_only%%' => strip_tags( $r->post_excerpt ), '%%focuskw%%' => WPSEO_Meta::get_value( 'focuskw', $r->ID ), '%%id%%' => $r->ID, '%%modified%%' => mysql2date( get_option( 'date_format' ), $r->post_modified ), '%%name%%' => get_the_author_meta( 'display_name', ! empty( $r->post_author ) ? $r->post_author : get_query_var( 'author' ) ), '%%tag%%' => wpseo_get_terms( $r->ID, 'post_tag' ), '%%title%%' => stripslashes( $r->post_title ), '%%userid%%' => ! empty( $r->post_author ) ? $r->post_author : get_query_var( 'author' ), ) ); } if ( ! empty( $r->taxonomy ) ) { $replacements = array_merge( $replacements, array( '%%category_description%%' => trim( strip_tags( get_term_field( 'description', $r->term_id, $r->taxonomy ) ) ), '%%tag_description%%' => trim( strip_tags( get_term_field( 'description', $r->term_id, $r->taxonomy ) ) ), '%%term_description%%' => trim( strip_tags( get_term_field( 'description', $r->term_id, $r->taxonomy ) ) ), '%%term_title%%' => $r->name, ) ); } /** * Filter: 'wpseo_replacements' - Allow customization of the replacements before they are applied * * @api array $replacements The replacements */ $replacements = apply_filters( 'wpseo_replacements', $replacements ); foreach ( $replacements as $var => $repl ) { if ( ! in_array( $var, $omit ) ) { $string = str_replace( $var, $repl, $string ); } } if ( strpos( $string, '%%' ) === false ) { $string = preg_replace( '`\s+`u', ' ', $string ); return trim( $string ); } if ( isset( $wp_query->query_vars['post_type'] ) && preg_match_all( '`%%pt_([^%]+)%%`u', $string, $matches, PREG_SET_ORDER ) ) { $post_type = $wp_query->query_vars['post_type']; if ( is_array( $post_type ) ) { $post_type = reset( $post_type ); } $pt = get_post_type_object( $post_type ); $pt_plural = $pt_singular = $pt->name; if ( isset( $pt->labels->singular_name ) ) { $pt_singular = $pt->labels->singular_name; } if ( isset( $pt->labels->name ) ) { $pt_plural = $pt->labels->name; } $string = str_replace( '%%pt_single%%', $pt_singular, $string ); $string = str_replace( '%%pt_plural%%', $pt_plural, $string ); } if ( ( is_singular() || is_admin() ) && preg_match_all( '`%%cf_([^%]+)%%`u', $string, $matches, PREG_SET_ORDER ) ) { global $post; if( is_object( $post ) && isset( $post->ID ) ) { foreach ( $matches as $match ) { $string = str_replace( $match[0], get_post_meta( $post->ID, $match[1], true ), $string ); } } } if ( ( is_singular() || is_admin() ) && false !== strpos( $string, '%%parent_title%%' ) ) { global $post; if ( isset( $post->post_parent ) && 0 != $post->post_parent ) { $parent_title = get_the_title( $post->post_parent ); $string = str_replace( '%%parent_title%%', $parent_title, $string ); } } if ( preg_match_all( '`%%ct_desc_([^%]+)?%%`u', $string, $matches, PREG_SET_ORDER ) ) { global $post; foreach ( $matches as $match ) { $terms = get_the_terms( $post->ID, $match[1] ); if ( is_array( $terms ) && $terms !== array() ) { $term = current( $terms ); $string = str_replace( $match[0], get_term_field( 'description', $term->term_id, $match[1] ), $string ); } else { // Make sure that the variable is removed ? $string = str_replace( $match[0], '', $string ); /* Check for WP_Error object (=invalid taxonomy entered) and if it's an error, notify in admin dashboard */ if ( is_wp_error( $terms ) && is_admin() ) { add_action( 'admin_notices', 'wpseo_invalid_custom_taxonomy' ); } } } } if ( preg_match_all( '`%%ct_([^%]+)%%(single%%)?`u', $string, $matches, PREG_SET_ORDER ) ) { foreach ( $matches as $match ) { $single = false; if ( isset( $match[2] ) && $match[2] == 'single%%' ) { $single = true; } $ct_terms = wpseo_get_terms( $r->ID, $match[1], $single ); $string = str_replace( $match[0], $ct_terms, $string ); } } $string = preg_replace( '`\s+`u', ' ', $string ); return trim( $string ); }
</option> </select> <input type="submit" value="<?php esc_attr_e('Apply'); ?> " name="doaction2" id="doaction2" class="button-secondary action" /> </div> <br class="clear" /> </div> <br class="clear" /> </form> <div class="form-wrap"> <p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the links in that category. Instead, links that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), get_term_field('name', get_option('default_link_category'), 'link_category')); ?> </p> </div> </div> </div><!-- /col-right --> <div id="col-left"> <div class="col-wrap"> <?php if (current_user_can('manage_categories')) { $category = (object) array(); $category->parent = 0;
function gantry_assignment_item_menu_meta_box($object, $menu, $assignments) { $menu_name = $menu['args']->name; $args = array('child_of' => 0, 'exclude' => '', 'hide_empty' => false, 'hierarchical' => 1, 'include' => '', 'include_last_update_time' => false, 'order' => 'ASC', 'orderby' => 'name', 'pad_counts' => false); $menu_items = wp_get_nav_menu_items($menu_name); if (!$menu_items || is_wp_error($menu_items)) { echo '<p>' . _g('No items.') . '</p>'; return; } foreach ($menu_items as $menu_item) { $menu_item->menu_id = $menu_name; } $menu_entires = array(); foreach ($menu_items as $menu_item) { $item = new AssignmentItem(); $item->archetype = $menu['args']->archetype; $item->type = $menu_name; $item->id = $menu_item->ID; $item->single_label = $menu['args']->single_label; $item->parent_id = empty($menu_item->menu_item_parent) ? get_post_meta($menu_item->ID, '_menu_item_menu_item_parent', true) : $menu_item->menu_item_parent; // Get the title and url info $menu_item->object_id = empty($menu_item->object_id) ? get_post_meta($menu_item->ID, '_menu_item_object_id', true) : $menu_item->object_id; $menu_item->object = empty($menu_item->object) ? get_post_meta($menu_item->ID, '_menu_item_object', true) : $menu_item->object; $menu_item->type = empty($menu_item->type) ? get_post_meta($menu_item->ID, '_menu_item_type', true) : $menu_item->type; if ('post_type' == $menu_item->type) { $object = get_post_type_object($menu_item->object); $menu_item->url = get_permalink($menu_item->object_id); $original_object = get_post($menu_item->object_id); $original_title = $original_object->post_title; $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; } elseif ('taxonomy' == $menu_item->type) { $object = get_taxonomy($menu_item->object); $term_url = get_term_link((int) $menu_item->object_id, $menu_item->object); $menu_item->url = !is_wp_error($term_url) ? $term_url : ''; $original_title = get_term_field('name', $menu_item->object_id, $menu_item->object, 'raw'); $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; } else { $menu_item->title = $menu_item->post_title; $menu_item->url = empty($menu_item->url) ? get_post_meta($menu_item->ID, '_menu_item_url', true) : $menu_item->url; } $item->title = $menu_item->title; $menu_entires[] = $item; } $walker = new GantryAssignmentWalker(); $args['assignments'] = $assignments; ?> <div id="menu-<?php echo $menu_name; ?> " class="menudiv"> <ul id="<?php echo $menu_name; ?> checklist" class="list:<?php echo $menu_name; ?> categorychecklist form-no-clear"> <?php $args['walker'] = $walker; echo gantry_walk_assignment_tree($menu_entires, 0, (object) $args); ?> </ul> </div><!-- /.menudiv --> <?php }
function ut_wp_update_nav_menu_item($menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array()) { $menu_id = (int) $menu_id; $menu_item_db_id = (int) $menu_item_db_id; // make sure that we don't convert non-nav_menu_item objects into nav_menu_item objects if (!empty($menu_item_db_id) && !is_nav_menu_item($menu_item_db_id)) { return new WP_Error('update_nav_menu_item_failed', __('The given object ID is not that of a menu item.', 'unitedthemes')); } $menu = wp_get_nav_menu_object($menu_id); if (!$menu && 0 !== $menu_id || is_wp_error($menu)) { return $menu; } $defaults = array('menu-item-db-id' => $menu_item_db_id, 'menu-item-object-id' => 0, 'menu-item-object' => '', 'menu-item-parent-id' => 0, 'menu-item-position' => 0, 'menu-item-type' => 'custom', 'menu-item-title' => '', 'menu-item-url' => '', 'menu-item-description' => '', 'menu-item-attr-title' => '', 'menu-item-target' => '', 'menu-item-classes' => '', 'menu-item-xfn' => '', 'menu-item-menutype' => '', 'menu-item-status' => ''); $args = wp_parse_args($menu_item_data, $defaults); if (0 == $menu_id) { $args['menu-item-position'] = 1; } elseif (0 == (int) $args['menu-item-position']) { $menu_items = 0 == $menu_id ? array() : (array) wp_get_nav_menu_items($menu_id, array('post_status' => 'publish,draft')); $last_item = array_pop($menu_items); $args['menu-item-position'] = $last_item && isset($last_item->menu_order) ? 1 + $last_item->menu_order : count($menu_items); } $original_parent = 0 < $menu_item_db_id ? get_post_field('post_parent', $menu_item_db_id) : 0; if ('custom' != $args['menu-item-type']) { /* if non-custom menu item, then: * use original object's URL * blank default title to sync with original object's */ $args['menu-item-url'] = ''; $original_title = ''; if ('taxonomy' == $args['menu-item-type']) { $original_parent = get_term_field('parent', $args['menu-item-object-id'], $args['menu-item-object'], 'raw'); $original_title = get_term_field('name', $args['menu-item-object-id'], $args['menu-item-object'], 'raw'); } elseif ('post_type' == $args['menu-item-type']) { $original_object = get_post($args['menu-item-object-id']); $original_parent = (int) $original_object->post_parent; $original_title = $original_object->post_title; } if ($args['menu-item-title'] == $original_title) { $args['menu-item-title'] = ''; } // hack to get wp to create a post object when too many properties are empty if ('' == $args['menu-item-title'] && '' == $args['menu-item-description']) { $args['menu-item-description'] = ' '; } } // Populate the menu item object $post = array('menu_order' => $args['menu-item-position'], 'ping_status' => 0, 'post_content' => $args['menu-item-description'], 'post_excerpt' => $args['menu-item-attr-title'], 'post_parent' => $original_parent, 'post_title' => $args['menu-item-title'], 'post_type' => 'nav_menu_item'); $update = 0 != $menu_item_db_id; // Only set the menu term if it isn't set to avoid unnecessary wp_get_object_terms() if ($menu_id && (!$update || !is_object_in_term($menu_item_db_id, 'nav_menu', (int) $menu->term_id))) { $post['tax_input'] = array('nav_menu' => array(intval($menu->term_id))); } // New menu item. Default is draft status if (!$update) { $post['ID'] = 0; $post['post_status'] = 'publish' == $args['menu-item-status'] ? 'publish' : 'draft'; $menu_item_db_id = wp_insert_post($post); if (!$menu_item_db_id || is_wp_error($menu_item_db_id)) { return $menu_item_db_id; } } if ('custom' == $args['menu-item-type']) { $args['menu-item-object-id'] = $menu_item_db_id; $args['menu-item-object'] = 'custom'; } $menu_item_db_id = (int) $menu_item_db_id; update_post_meta($menu_item_db_id, '_menu_item_type', sanitize_key($args['menu-item-type'])); update_post_meta($menu_item_db_id, '_menu_item_menu_item_parent', strval((int) $args['menu-item-parent-id'])); update_post_meta($menu_item_db_id, '_menu_item_object_id', strval((int) $args['menu-item-object-id'])); update_post_meta($menu_item_db_id, '_menu_item_object', sanitize_key($args['menu-item-object'])); update_post_meta($menu_item_db_id, '_menu_item_target', sanitize_key($args['menu-item-target'])); $args['menu-item-classes'] = array_map('sanitize_html_class', explode(' ', $args['menu-item-classes'])); $args['menu-item-xfn'] = implode(' ', array_map('sanitize_html_class', explode(' ', $args['menu-item-xfn']))); update_post_meta($menu_item_db_id, '_menu_item_classes', $args['menu-item-classes']); update_post_meta($menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn']); update_post_meta($menu_item_db_id, '_menu_item_menutype', $args['menu_item_menutype']); update_post_meta($menu_item_db_id, '_menu_item_url', esc_url_raw($args['menu-item-url'])); if (0 == $menu_id) { update_post_meta($menu_item_db_id, '_menu_item_orphaned', (string) time()); } elseif (get_post_meta($menu_item_db_id, '_menu_item_orphaned')) { delete_post_meta($menu_item_db_id, '_menu_item_orphaned'); } // Update existing menu item. Default is publish status if ($update) { $post['ID'] = $menu_item_db_id; $post['post_status'] = 'draft' == $args['menu-item-status'] ? 'draft' : 'publish'; wp_update_post($post); } do_action('ut_wp_update_nav_menu_item', $menu_id, $menu_item_db_id, $args); return $menu_item_db_id; }
function category_description($category = 0) { global $cat; if (!$category) { $category = $cat; } return get_term_field('description', $category, 'category'); }
function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; ob_start(); $item_id = esc_attr($item->ID); $removed_args = array('action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce'); $original_title = ''; if ('taxonomy' == $item->type) { $original_title = get_term_field('name', $item->object_id, $item->object, 'raw'); if (is_wp_error($original_title)) { $original_title = false; } } elseif ('post_type' == $item->type) { $original_object = get_post($item->object_id); $original_title = get_the_title($original_object->ID); } $classes = array('menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr($item->object), 'menu-item-edit-' . (isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ? 'active' : 'inactive')); $title = $item->title; if (!empty($item->_invalid)) { $classes[] = 'menu-item-invalid'; /* translators: %s: title of menu item which is invalid */ $title = sprintf(__('%s (Invalid)', 'fw'), $item->title); } elseif (isset($item->post_status) && 'draft' == $item->post_status) { $classes[] = 'pending'; /* translators: %s: title of menu item in draft status */ $title = sprintf(__('%s (Pending)', 'fw'), $item->title); } $title = !isset($item->label) || '' == $item->label ? $title : $item->label; $submenu_text = ''; if (0 == $depth) { $submenu_text = 'style="display: none;"'; } ?> <li id="menu-item-<?php echo $item_id; ?> " class="<?php echo implode(' ', $classes); ?> "> <dl class="menu-item-bar"> <dt class="menu-item-handle"> <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', 'fw'); ?> </span></span> <span class="item-controls"> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <span class="item-type show-if-mega-menu-top"><?php echo __('Mega Menu', 'fw'); ?> </span> <span class="item-type show-if-mega-menu-column"><?php echo __('Column', 'fw'); ?> </span> <span class="item-type hide-if-mega-menu-top hide-if-mega-menu-column"><?php echo esc_html($item->type_label); ?> </span> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <span class="item-order hide-if-js"> <a href="<?php echo wp_nonce_url(esc_url(add_query_arg(array('action' => 'move-up-menu-item', 'menu-item' => $item_id)), esc_url(remove_query_arg($removed_args, admin_url('nav-menus.php')))), 'move-menu_item'); ?> " class="item-move-up"><abbr title="<?php esc_attr_e('Move up', 'fw'); ?> ">↑</abbr></a> | <a href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'move-down-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'); ?> " class="item-move-down"><abbr title="<?php esc_attr_e('Move down', 'fw'); ?> ">↓</abbr></a> </span> <a class="item-edit" id="edit-<?php echo $item_id; ?> " title="<?php esc_attr_e('Edit Menu Item', 'fw'); ?> " href="<?php 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))); ?> "><?php _e('Edit Menu Item', 'fw'); ?> </a> </span> </dt> </dl> <div class="menu-item-settings" id="menu-item-settings-<?php echo $item_id; ?> "> <?php if ('custom' == $item->type) { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <p class="field-url description description-wide hide-if-mega-menu-column"> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <label for="edit-menu-item-url-<?php echo $item_id; ?> "> <?php _e('URL', 'fw'); ?> <br /> <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?> " class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->url); ?> " /> </label> </p> <?php } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <p class="description description-thin hide-if-mega-menu-column hide-if-mega-menu-item"> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <label for="edit-menu-item-title-<?php echo $item_id; ?> "> <?php _e('Navigation Label', 'fw'); ?> <br /> <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?> " class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->title); ?> " /> </label> </p> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <p class="description description-thin hide-if-mega-menu-column hide-if-mega-menu-item"> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <label for="edit-menu-item-attr-title-<?php echo $item_id; ?> "> <?php _e('Title Attribute', 'fw'); ?> <br /> <input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?> " class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->post_excerpt); ?> " /> </label> </p> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <p class="field-link-target description hide-if-mega-menu-column"> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <label for="edit-menu-item-target-<?php echo $item_id; ?> "> <input type="checkbox" id="edit-menu-item-target-<?php echo $item_id; ?> " value="_blank" name="menu-item-target[<?php echo $item_id; ?> ]"<?php checked($item->target, '_blank'); ?> /> <?php _e('Open link in a new window/tab', 'fw'); ?> </label> </p> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <p class="field-css-classes description description-thin hide-if-mega-menu-column"> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <label for="edit-menu-item-classes-<?php echo $item_id; ?> "> <?php _e('CSS Classes (optional)', 'fw'); ?> <br /> <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)); ?> " /> </label> </p> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <p class="field-xfn description description-thin hide-if-mega-menu-column"> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <label for="edit-menu-item-xfn-<?php echo $item_id; ?> "> <?php _e('Link Relationship (XFN)', 'fw'); ?> <br /> <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?> " class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->xfn); ?> " /> </label> </p> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Column ?> <p class="description description-wide show-if-mega-menu-column show-if-mega-menu-item"> <label> <span class="hide-if-mega-menu-item"><?php _e('Mega Menu Column Title', 'fw'); ?> </span> <span class="hide-if-mega-menu-column"><?php _e('Item Title', 'fw'); ?> </span><br /> <?php // -------------------------- ?> <?php // NOTE this is a post title! ?> <?php // -------------------------- ?> <input type="text" name="menu-item-title[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->title); ?> " class="widefat mega-menu-title" /> </label> <label class="mega-menu-title-off-label"> <input type="checkbox" name="<?php echo fw_mega_menu_name_meta($item, 'title-off'); ?> " <?php checked(fw_mega_menu_get_meta($item, 'title-off')); ?> class="mega-menu-title-off" /> Hide </label> </p> <p class="description description-wide show-if-mega-menu-column"> <label> <input type="checkbox" name="<?php echo fw_mega_menu_name_meta($item, 'new-row'); ?> " <?php checked(fw_mega_menu_get_meta($item, 'new-row')); ?> class="mega-menu-column-new-row" /> <?php _e('This column should start a new row', 'fw'); ?> </label> </p> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <p class="field-description description description-wide hide-if-mega-menu-column force-show-if-mega-menu-item"> <label for="edit-menu-item-description-<?php echo $item_id; ?> "> <?php _e('Menu Subtitle', 'fw'); ?> <br /> <input type="text" id="edit-menu-item-description-<?php echo $item_id; ?> " class="widefat edit-menu-item-description" name="menu-item-description[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->description); ?> "/> <span class="description"><?php _e('This for Starry main menus left and right.', 'fw'); ?> </span> </label> </p> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Icon ?> <p class="field-mega-menu-icon description description-wide empty show-if-screen-options-icon"> <label> <?php _e('Icon', 'fw'); ?> <br /> <a href="#" class="button" data-action="mega-menu-pick-icon"> <span class="inline-if-empty">Add Icon</span> <span class="hide-if-empty">Edit Icon</span> </a> <span data-action="mega-menu-pick-icon" class="mega-menu-icon-frame hide-if-empty" style="position: relative;"> <i data-subject="mega-menu-icon-i"></i> <a href="#" class="mega-menu-icon-remove dashicons fw-x" data-action="mega-menu-remove-icon" title="Remove Icon"></a> </span> <span class="mega-menu-icon-frame inline-if-empty" data-action="mega-menu-pick-icon"><i class="fa fa-lg fa-eye" style="position: relative; top: -1px;"></i></span> <input type="hidden" name="<?php echo fw_mega_menu_name_meta($item, 'icon'); ?> " value="<?php echo esc_attr(fw_mega_menu_get_meta($item, 'icon')); ?> " data-subject="mega-menu-icon-input" /> </label> </p> <?php # Use as Mega Menu ?> <p class="description description-wide show-if-menu-top"> <label> <input type="checkbox" name="<?php echo fw_mega_menu_name_meta($item, 'enabled'); ?> " <?php checked(fw_mega_menu_get_meta($item, 'enabled')); ?> class="mega-menu-enabled" /> Use as Mega Menu </label> </p> <p class="field-move hide-if-no-js description description-wide hide-if-mega-menu-column"> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <label> <span><?php _e('Move', 'fw'); ?> </span> <a href="#" class="menus-move-up"><?php _e('Up one', 'fw'); ?> </a> <a href="#" class="menus-move-down"><?php _e('Down one', 'fw'); ?> </a> <a href="#" class="menus-move-left"></a> <a href="#" class="menus-move-right"></a> <a href="#" class="menus-move-top"><?php _e('To the top', 'fw'); ?> </a> </label> </p> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <div class="menu-item-actions description-wide submitbox"> <?php # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?> <?php if ('custom' != $item->type && $original_title !== false) { ?> <p class="link-to-original hide-if-mega-menu-column"> <?php printf(__('Original: %s', 'fw'), '<a href="' . esc_attr($item->url) . '">' . esc_html($original_title) . '</a>'); ?> </p> <?php } ?> <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?> " href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'delete-menu-item', 'menu-item' => $item_id), admin_url('nav-menus.php')), 'delete-menu_item_' . $item_id); ?> "><?php _e('Remove', 'fw'); ?> </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'))); ?> #menu-item-settings-<?php echo $item_id; ?> "><?php _e('Cancel', 'fw'); ?> </a> </div> <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?> ]" value="<?php echo $item_id; ?> " /> <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); ?> " /> <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->object); ?> " /> <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->menu_item_parent); ?> " /> <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->menu_order); ?> " /> <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->type); ?> " /> </div><!-- .menu-item-settings--> <ul class="menu-item-transport"></ul> <?php $output .= ob_get_clean(); }
public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; ob_start(); $item_id = esc_attr($item->ID); $removed_args = array('action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce'); $original_title = ''; if ('taxonomy' == $item->type) { $original_title = get_term_field('name', $item->object_id, $item->object, 'raw'); if (is_wp_error($original_title)) { $original_title = false; } } elseif ('post_type' == $item->type) { $original_object = get_post($item->object_id); $original_title = get_the_title($original_object->ID); } elseif ('post_type_archive' == $item->type) { $original_object = get_post_type_object($item->object); $original_title = $original_object->labels->archives; } $classes = array('menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr($item->object), 'menu-item-edit-' . (isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ? 'active' : 'inactive')); $title = $item->title; if (!empty($item->_invalid)) { $classes[] = 'menu-item-invalid'; /* translators: %s: title of menu item which is invalid */ $title = sprintf(__('%s (Invalid)'), $item->title); } elseif (isset($item->post_status) && 'draft' == $item->post_status) { $classes[] = 'pending'; /* translators: %s: title of menu item in draft status */ $title = sprintf(__('%s (Pending)'), $item->title); } $title = !isset($item->label) || '' == $item->label ? $title : $item->label; $submenu_text = ''; if (0 == $depth) { $submenu_text = 'style="display: none;"'; } ?> <li id="menu-item-<?php echo $item_id; ?> " class="<?php echo implode(' ', $classes); ?> "> <div class="menu-item-bar"> <div class="menu-item-handle"> <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> <span class="item-controls"> <span class="item-type"><?php echo esc_html($item->type_label); ?> </span> <span class="item-order hide-if-js"> <a href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'move-up-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'); ?> " class="item-move-up"><abbr title="<?php esc_attr_e('Move up'); ?> ">↑</abbr></a> | <a href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'move-down-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'); ?> " class="item-move-down"><abbr title="<?php esc_attr_e('Move down'); ?> ">↓</abbr></a> </span> <a class="item-edit" id="edit-<?php echo $item_id; ?> " title="<?php esc_attr_e('Edit Menu Item'); ?> " href="<?php 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))); ?> "><?php _e('Edit Menu Item'); ?> </a> </span> </div> </div> <div class="menu-item-settings" id="menu-item-settings-<?php echo $item_id; ?> "> <?php if ('custom' == $item->type) { ?> <p class="field-url description description-wide"> <label for="edit-menu-item-url-<?php echo $item_id; ?> "> <?php _e('URL'); ?> <br /> <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?> " class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->url); ?> " /> </label> </p> <?php } ?> <p class="description description-wide"> <label for="edit-menu-item-title-<?php echo $item_id; ?> "> <?php _e('Navigation Label'); ?> <br /> <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?> " class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->title); ?> " /> </label> </p> <p class="field-title-attribute description description-wide"> <label for="edit-menu-item-attr-title-<?php echo $item_id; ?> "> <?php _e('Title Attribute'); ?> <br /> <input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?> " class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->post_excerpt); ?> " /> </label> </p> <p class="field-link-target description"> <label for="edit-menu-item-target-<?php echo $item_id; ?> "> <input type="checkbox" id="edit-menu-item-target-<?php echo $item_id; ?> " value="_blank" name="menu-item-target[<?php echo $item_id; ?> ]"<?php checked($item->target, '_blank'); ?> /> <?php _e('Open link in a new tab'); ?> </label> </p> <p class="field-css-classes description description-thin"> <label for="edit-menu-item-classes-<?php echo $item_id; ?> "> <?php _e('CSS Classes (optional)'); ?> <br /> <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)); ?> " /> </label> </p> <p class="field-xfn description description-thin"> <label for="edit-menu-item-xfn-<?php echo $item_id; ?> "> <?php _e('Link Relationship (XFN)'); ?> <br /> <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?> " class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->xfn); ?> " /> </label> </p> <p class="field-description description description-wide"> <label for="edit-menu-item-description-<?php echo $item_id; ?> "> <?php _e('Description'); ?> <br /> <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> <span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?> </span> </label> </p> <!-- sells-pro FA ICON CLASS FIELD--> <p class="field-fa-icon-class description description-wide"> <label for="edit-menu-item-fa-icon-class<?php echo $item_id; ?> "> <?php _e('Font Awesome Icon Class (sells-pro)'); ?> <br /> <input type="text" id="edit-menu-item-fa-icon-class<?php echo $item_id; ?> " class="widefat edit-menu-item-fa-icon-class" name="menu-item-fa-icon-class[<?php echo $item_id; ?> ]" value="<?php echo esc_html($item->fa_icon_class); ?> " /> <span class="description"><?php _e('Used to create icon. If used, navigation title will not be displayed.'); ?> </span> </label> </p> <!-- end of sells-pro FA ICON CLASS FIELD --> <p class="field-move hide-if-no-js description description-wide"> <label> <span><?php _e('Move'); ?> </span> <a href="#" class="menus-move menus-move-up" data-dir="up"><?php _e('Up one'); ?> </a> <a href="#" class="menus-move menus-move-down" data-dir="down"><?php _e('Down one'); ?> </a> <a href="#" class="menus-move menus-move-left" data-dir="left"></a> <a href="#" class="menus-move menus-move-right" data-dir="right"></a> <a href="#" class="menus-move menus-move-top" data-dir="top"><?php _e('To the top'); ?> </a> </label> </p> <div class="menu-item-actions description-wide submitbox"> <?php if ('custom' != $item->type && $original_title !== false) { ?> <p class="link-to-original"> <?php printf(__('Original: %s'), '<a href="' . esc_attr($item->url) . '">' . esc_html($original_title) . '</a>'); ?> </p> <?php } ?> <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?> " href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'delete-menu-item', 'menu-item' => $item_id), admin_url('nav-menus.php')), 'delete-menu_item_' . $item_id); ?> "><?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'))); ?> #menu-item-settings-<?php echo $item_id; ?> "><?php _e('Cancel'); ?> </a> </div> <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?> ]" value="<?php echo $item_id; ?> " /> <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); ?> " /> <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->object); ?> " /> <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->menu_item_parent); ?> " /> <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->menu_order); ?> " /> <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->type); ?> " /> </div><!-- .menu-item-settings--> <ul class="menu-item-transport"></ul> <?php $output .= ob_get_clean(); }
/** * Retrieve a post/page/cpt's custom taxonomies description for use as replacement string * * @param string $var The complete variable to replace which includes the name of * the custom taxonomy which description is to be retrieved. * * @return string|null */ private function retrieve_ct_desc_custom_tax_name($var) { global $post; $replacement = null; if (is_string($var) && $var !== '') { $tax = substr($var, 8); if (is_object($post) && isset($post->ID)) { $terms = get_the_terms($post->ID, $tax); if (is_array($terms) && $terms !== array()) { $term = current($terms); $term_desc = get_term_field('description', $term->term_id, $tax); if ($term_desc !== '') { $replacement = $term_desc; } } } } return $replacement; }
/** * @param string $string the string to replace the variables in. * @param array $args the object some of the replacement values might come from, could be a post, taxonomy or term. * @param array $omit variables that should not be replaced by this function. * @return string */ function wpseo_replace_vars($string, $args, $omit = array()) { $args = (array) $args; $string = strip_tags($string); // Let's see if we can bail super early. if (strpos($string, '%%') === false) { return trim(preg_replace('/\\s+/u', ' ', $string)); } global $sep; if (!isset($sep) || empty($sep)) { $sep = '-'; } $simple_replacements = array('%%sep%%' => $sep, '%%sitename%%' => get_bloginfo('name'), '%%sitedesc%%' => get_bloginfo('description'), '%%currenttime%%' => date('H:i'), '%%currentdate%%' => date('M jS Y'), '%%currentmonth%%' => date('F'), '%%currentyear%%' => date('Y')); foreach ($simple_replacements as $var => $repl) { $string = str_replace($var, $repl, $string); } // Let's see if we can bail early. if (strpos($string, '%%') === false) { return trim(preg_replace('/\\s+/u', ' ', $string)); } global $wp_query; $defaults = array('ID' => '', 'name' => '', 'post_author' => '', 'post_content' => '', 'post_date' => '', 'post_excerpt' => '', 'post_modified' => '', 'post_title' => '', 'taxonomy' => '', 'term_id' => ''); if (isset($args['post_content'])) { $args['post_content'] = wpseo_strip_shortcode($args['post_content']); } if (isset($args['post_excerpt'])) { $args['post_excerpt'] = wpseo_strip_shortcode($args['post_excerpt']); } $r = (object) wp_parse_args($args, $defaults); $max_num_pages = 1; if (!is_single()) { $pagenum = get_query_var('paged'); if ($pagenum === 0) { $pagenum = 1; } if (isset($wp_query->max_num_pages) && $wp_query->max_num_pages != '' && $wp_query->max_num_pages != 0) { $max_num_pages = $wp_query->max_num_pages; } } else { global $post; $pagenum = get_query_var('page'); $max_num_pages = isset($post->post_content) ? substr_count($post->post_content, '<!--nextpage-->') : 1; if ($max_num_pages >= 1) { $max_num_pages++; } } // Let's do date first as it's a bit more work to get right. if ($r->post_date != '') { $date = mysql2date(get_option('date_format'), $r->post_date); } else { if (get_query_var('day') && get_query_var('day') != '') { $date = get_the_date(); } else { if (single_month_title(' ', false) && single_month_title(' ', false) != '') { $date = single_month_title(' ', false); } else { if (get_query_var('year') != '') { $date = get_query_var('year'); } else { $date = ''; } } } } $replacements = array('%%date%%' => $date, '%%searchphrase%%' => esc_html(get_query_var('s')), '%%page%%' => $max_num_pages > 1 && $pagenum > 1 ? sprintf($sep . ' ' . __('Page %d of %d', 'wordpress-seo'), $pagenum, $max_num_pages) : '', '%%pagetotal%%' => $max_num_pages, '%%pagenumber%%' => $pagenum); if (isset($r->ID)) { $replacements = array_merge($replacements, array('%%caption%%' => $r->post_excerpt, '%%category%%' => wpseo_get_terms($r->ID, 'category'), '%%excerpt%%' => !empty($r->post_excerpt) ? strip_tags($r->post_excerpt) : utf8_encode(substr(strip_shortcodes(strip_tags(utf8_decode($r->post_content))), 0, 155)), '%%excerpt_only%%' => strip_tags($r->post_excerpt), '%%focuskw%%' => wpseo_get_value('focuskw', $r->ID), '%%id%%' => $r->ID, '%%modified%%' => mysql2date(get_option('date_format'), $r->post_modified), '%%name%%' => get_the_author_meta('display_name', !empty($r->post_author) ? $r->post_author : get_query_var('author')), '%%tag%%' => wpseo_get_terms($r->ID, 'post_tag'), '%%title%%' => stripslashes($r->post_title), '%%userid%%' => !empty($r->post_author) ? $r->post_author : get_query_var('author'))); } if (!empty($r->taxonomy)) { $replacements = array_merge($replacements, array('%%category_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%tag_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%term_description%%' => trim(strip_tags(get_term_field('description', $r->term_id, $r->taxonomy))), '%%term_title%%' => $r->name)); } foreach ($replacements as $var => $repl) { if (!in_array($var, $omit)) { $string = str_replace($var, $repl, $string); } } if (strpos($string, '%%') === false) { $string = preg_replace('/\\s+/u', ' ', $string); return trim($string); } if (isset($wp_query->query_vars['post_type']) && preg_match_all('/%%pt_([^%]+)%%/u', $string, $matches, PREG_SET_ORDER)) { $pt = get_post_type_object($wp_query->query_vars['post_type']); $pt_plural = $pt_singular = $pt->name; if (isset($pt->labels->singular_name)) { $pt_singular = $pt->labels->singular_name; } if (isset($pt->labels->name)) { $pt_plural = $pt->labels->name; } $string = str_replace('%%pt_single%%', $pt_singular, $string); $string = str_replace('%%pt_plural%%', $pt_plural, $string); } if (preg_match_all('/%%cf_([^%]+)%%/u', $string, $matches, PREG_SET_ORDER)) { global $post; foreach ($matches as $match) { $string = str_replace($match[0], get_post_meta($post->ID, $match[1], true), $string); } } if (preg_match_all('/%%ct_desc_([^%]+)?%%/u', $string, $matches, PREG_SET_ORDER)) { global $post; foreach ($matches as $match) { $terms = get_the_terms($post->ID, $match[1]); $string = str_replace($match[0], get_term_field('description', $terms[0]->term_id, $match[1]), $string); } } if (preg_match_all('/%%ct_([^%]+)%%(single%%)?/u', $string, $matches, PREG_SET_ORDER)) { foreach ($matches as $match) { $single = false; if (isset($match[2]) && $match[2] == 'single%%') { $single = true; } $ct_terms = wpseo_get_terms($r->ID, $match[1], $single); $string = str_replace($match[0], $ct_terms, $string); } } $string = preg_replace('/\\s+/u', ' ', $string); return trim($string); }
/** * Gets the loop description. This function should only be used on archive-type pages, such as archive, blog, and * search results pages. It outputs the description of the page. * * @link http://core.trac.wordpress.org/ticket/21995 * @since 2.0.0 * @access public * @return string */ function hybrid_get_loop_description() { $loop_desc = ''; if (is_home() && !is_front_page()) { $loop_desc = get_post_field('post_content', get_queried_object_id(), 'raw'); } elseif (is_category()) { $loop_desc = get_term_field('description', get_queried_object_id(), 'category', 'raw'); } elseif (is_tag()) { $loop_desc = get_term_field('description', get_queried_object_id(), 'post_tag', 'raw'); } elseif (is_tax()) { $loop_desc = get_term_field('description', get_queried_object_id(), get_query_var('taxonomy'), 'raw'); } elseif (is_author()) { $loop_desc = get_the_author_meta('description', get_query_var('author')); } elseif (is_search()) { $loop_desc = sprintf(__('You are browsing the search results for “%s”', 'hybrid-core'), get_search_query()); } elseif (is_post_type_archive()) { $loop_desc = get_post_type_object(get_query_var('post_type'))->description; } elseif (is_time()) { $loop_desc = __('You are browsing the site archives by time.', 'hybrid-core'); } elseif (is_day()) { $loop_desc = sprintf(__('You are browsing the site archives for %s.', 'hybrid-core'), hybrid_single_day_title('', false)); } elseif (is_month()) { $loop_desc = sprintf(__('You are browsing the site archives for %s.', 'hybrid-core'), single_month_title(' ', false)); } elseif (is_year()) { $loop_desc = sprintf(__('You are browsing the site archives for %s.', 'hybrid-core'), hybrid_single_year_title('', false)); } elseif (is_archive()) { $loop_desc = __('You are browsing the site archives.', 'hybrid-core'); } return apply_filters('hybrid_loop_description', $loop_desc); }
function get_filtered($data) { extract($data); return get_term_field($this->field, $term_id, $taxonomy); }
/** * series_description() - Gets the description of the series from the database for the supplied series_id * * @package Organize Series WordPress Plugin * @since 2.0 * * @uses get_term_field() * * @param int $series_id * @return string description text */ function series_description($series_id = 0) { global $orgseries; if (!$series_id) { $ser_var = get_query_var(SERIES_QUERYVAR); $ser_var = term_exists($ser_var, SERIES_QUERYVAR); if (!empty($ser_var)) { $series_id = $ser_var['term_id']; } } if ($series_id == '') { return false; } return get_term_field('description', $series_id, 'series'); }
/** * @see Walker::start_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param object $args */ function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { global $_wp_nav_menu_max_depth; if ($item->icon_pos == "") { $item->icon_pos = "Left"; } $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; $indent = $depth ? str_repeat("\t", $depth) : ''; $item_id = esc_attr($item->ID); $removed_args = array('action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce'); ob_start(); $original_title = ''; if ('taxonomy' == $item->type) { $original_title = get_term_field('name', $item->object_id, $item->object, 'raw'); if (is_wp_error($original_title)) { $original_title = false; } } elseif ('post_type' == $item->type) { $original_object = get_post($item->object_id); $original_title = $original_object->post_title; } $classes = array('menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr($item->object), 'menu-item-edit-' . (isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ? 'active' : 'inactive')); $title = $item->title; if (!empty($item->_invalid)) { $classes[] = 'menu-item-invalid'; /* translators: %s: title of menu item which is invalid */ $title = sprintf('%s (Invalid)', $item->title); } elseif (isset($item->post_status) && 'draft' == $item->post_status) { $classes[] = 'pending'; /* translators: %s: title of menu item in draft status */ $title = sprintf('%s (Pending)', $item->title); } $title = empty($item->label) ? $title : $item->label; ?> <li id="menu-item-<?php echo esc_attr($item_id); ?> " class="<?php echo implode(' ', $classes); ?> "> <dl class="menu-item-bar"> <dt class="menu-item-handle"> <span class="item-title"><?php echo esc_html($title); ?> </span> <span class="item-controls"> <span class="item-type"><?php echo esc_html($item->type_label); ?> </span> <span class="item-order hide-if-js"> <a href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'move-up-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'); ?> " class="item-move-up"><abbr title="Move up">↑</abbr></a> | <a href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'move-down-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'); ?> " class="item-move-down"><abbr title="Move down">↓</abbr></a> </span> <a class="item-edit" id="edit-<?php echo esc_attr($item_id); ?> " title="Edit Menu Item" href="<?php 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))); ?> "><?php echo 'Edit Menu Item'; ?> </a> </span> </dt> </dl> <div class="menu-item-settings" id="menu-item-settings-<?php echo esc_attr($item_id); ?> "> <?php if ('custom' == $item->type) { ?> <p class="description description-wide"> <label for="edit-menu-item-url-<?php echo esc_attr($item_id); ?> "> <?php echo 'URL'; ?> <br /> <input type="text" id="edit-menu-item-url-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-url" <?php if (esc_attr($item->url)) { ?> name="menu-item-url[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-url[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->url); ?> " /> </label> </p> <?php } ?> <?php //echo "<pre>"; print_r($item); echo "</pre>"; ?> <p class="description description-wide"> <label for="edit-menu-item-title-<?php echo esc_attr($item_id); ?> "> <?php echo 'Navigation Label'; ?> <br /> <input type="text" id="edit-menu-item-title-<?php echo esc_attr($item_id); ?> " class="widefat edit-menu-item-title" <?php if (esc_attr($item->title)) { ?> name="menu-item-title[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-title[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->title); ?> " /> </label> </p> <p class="description"> <label for="edit-menu-item-target-<?php echo esc_attr($item_id); ?> "> <input type="checkbox" id="edit-menu-item-target-<?php echo esc_attr($item_id); ?> " value="_blank" <?php if ($item->target == '_blank') { ?> name="menu-item-target[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-target[<?php echo esc_attr($item_id); ?> ]" <?php checked($item->target, '_blank'); ?> /> <?php echo 'Open link in a new window/tab'; ?> </label> </p> <?php /* New fields insertion starts here */ $arr_font = array('select', 'fa-adjust', 'fa-adn', 'fa-align-center', 'fa-align-justify', 'fa-align-left', 'fa-align-right', 'fa-ambulance', 'fa-anchor', 'fa-android', 'fa-angellist', 'fa-angle-double-down', 'fa-angle-double-left', 'fa-angle-double-right', 'fa-angle-double-up', 'fa-angle-down', 'fa-angle-left', 'fa-angle-right', 'fa-angle-up', 'fa-apple', 'fa-archive', 'fa-area-chart', 'fa-arrow-circle-down', 'fa-arrow-circle-left', 'fa-arrow-circle-o-down', 'fa-arrow-circle-o-left', 'fa-arrow-circle-o-right', 'fa-arrow-circle-o-up', 'fa-arrow-circle-right', 'fa-arrow-circle-up', 'fa-arrow-down', 'fa-arrow-left', 'fa-arrow-right', 'fa-arrow-up', 'fa-arrows', 'fa-arrows-alt', 'fa-arrows-h', 'fa-arrows-v', 'fa-asterisk', 'fa-at', 'fa-automobile', 'fa-backward', 'fa-ban', 'fa-bank', 'fa-bar-chart', 'fa-bar-chart-o', 'fa-barcode', 'fa-bars', 'fa-bed', 'fa-beer', 'fa-behance', 'fa-behance-square', 'fa-bell', 'fa-bell-o', 'fa-bell-slash', 'fa-bell-slash-o', 'fa-bicycle', 'fa-binoculars', 'fa-birthday-cake', 'fa-bitbucket', 'fa-bitbucket-square', 'fa-bitcoin', 'fa-bold', 'fa-bomb', 'fa-book', 'fa-bookmark', 'fa-bookmark-o', 'fa-briefcase', 'fa-btc', 'fa-bug', 'fa-building', 'fa-building-o', 'fa-bullhorn', 'fa-bullseye', 'fa-bus', 'fa-buysellads', 'fa-cab', 'fa-calculator', 'fa-calendar', 'fa-calendar-o', 'fa-camera', 'fa-camera-retro', 'fa-car', 'fa-caret-down', 'fa-caret-left', 'fa-caret-right', 'fa-caret-square-o-down', 'fa-caret-square-o-left', 'fa-caret-square-o-right', 'fa-caret-square-o-up', 'fa-caret-up', 'fa-cart-arrow-down', 'fa-cart-plus', 'fa-cc', 'fa-cc-amex', 'fa-cc-discover', 'fa-cc-mastercard', 'fa-cc-paypal', 'fa-cc-stripe', 'fa-cc-visa', 'fa-certificate', 'fa-chain', 'fa-chain-broken', 'fa-check', 'fa-check-circle', 'fa-check-circle-o', 'fa-check-square', 'fa-check-square-o', 'fa-chevron-circle-down', 'fa-chevron-circle-left', 'fa-chevron-circle-right', 'fa-chevron-circle-up', 'fa-chevron-down', 'fa-chevron-left', 'fa-chevron-right', 'fa-chevron-up', 'fa-child', 'fa-circle', 'fa-circle-o', 'fa-circle-o-notch', 'fa-circle-thin', 'fa-clipboard', 'fa-clock-o', 'fa-close', 'fa-cloud', 'fa-cloud-download', 'fa-cloud-upload', 'fa-cny', 'fa-code', 'fa-code-fork', 'fa-codepen', 'fa-coffee', 'fa-cog', 'fa-cogs', 'fa-columns', 'fa-comment', 'fa-comment-o', 'fa-comments', 'fa-comments-o', 'fa-compass', 'fa-compress', 'fa-compress', 'fa-connectdevelop', 'fa-copy', 'fa-copyright', 'fa-credit-card', 'fa-crop', 'fa-crosshairs', 'fa-css', 'fa-cube', 'fa-cubes', 'fa-cut', 'fa-cutlery', 'fa-dashboard', 'fa-dashcube', 'fa-database', 'fa-dedent', 'fa-delicious', 'fa-desktop', 'fa-deviantart', 'fa-diamond', 'fa-digg', 'fa-dollar', 'fa-dot-circle-o', 'fa-download', 'fa-dribbble', 'fa-dropbox', 'fa-drupal', 'fa-edit', 'fa-eject', 'fa-ellipsis-h', 'fa-ellipsis-v', 'fa-empire', 'fa-envelope', 'fa-envelope-o', 'fa-envelope-square', 'fa-eraser', 'fa-eur', 'fa-euro', 'fa-exchange', 'fa-exclamation', 'fa-exclamation-circle', 'fa-exclamation-triangle', 'fa-expand', 'fa-external-link', 'fa-external-link-square', 'fa-eye', 'fa-eye-slash', 'fa-eyedropper', 'fa-facebook', 'fa-facebook-f', 'fa-facebook-official', 'fa-facebook-square', 'fa-fast-backward', 'fa-fast-forward', 'fa-fax', 'fa-female', 'fa-fighter-jet', 'fa-file', 'fa-file-archive-o', 'fa-file-audio-o', 'fa-file-code-o', 'fa-file-excel-o', 'fa-file-image-o', 'fa-file-movie-o', 'fa-file-o', 'fa-file-pdf-o', 'fa-file-pdf-o', 'fa-file-picture-o', 'fa-file-powerpoint-o', 'fa-file-sound-o', 'fa-file-text', 'fa-file-text-o', 'fa-file-video-o', 'fa-file-word-o', 'fa-file-zip-o', 'fa-files-o', 'fa-film', 'fa-filter', 'fa-fire', 'fa-fire-extinguisher', 'fa-flag', 'fa-flag-checkered', 'fa-flag-o', 'fa-flash', 'fa-flask', 'fa-flickr', 'fa-floppy-o', 'fa-folder', 'fa-folder-o', 'fa-folder-open', 'fa-folder-open-o', 'fa-font', 'fa-forumbee', 'fa-forward', 'fa-foursquare', 'fa-frown-o', 'fa-futbol-o', 'fa-gamepad', 'fa-gavel', 'fa-gbp', 'fa-ge', 'fa-gear', 'fa-gears', 'fa-genderless', 'fa-gift', 'fa-git', 'fa-git-square', 'fa-github', 'fa-github-alt', 'fa-github-square', 'fa-gittip', 'fa-glass', 'fa-globe', 'fa-google', 'fa-google-plus', 'fa-google-plus-square', 'fa-google-wallet', 'fa-graduation-cap', 'fa-gratipay', 'fa-group', 'fa-h-square', 'fa-hacker-news', 'fa-hand-o-down', 'fa-hand-o-left', 'fa-hand-o-right', 'fa-hand-o-up', 'fa-hdd-o', 'fa-header', 'fa-headphones', 'fa-heart', 'fa-heart-o', 'fa-heartbeat', 'fa-history', 'fa-home', 'fa-hospital-o', 'fa-hotel', 'fa-html', 'fa-ils', 'fa-image', 'fa-inbox', 'fa-indent', 'fa-info', 'fa-circle', 'fa-inr', 'fa-instagram', 'fa-institution', 'fa-ioxhost', 'fa-italic', 'fa-joomla', 'fa-jpy', 'fa-jsfiddle', 'fa-key', 'fa-keyboard-o', 'fa-krw', 'fa-language', 'fa-laptop', 'fa-lastfm', 'fa-lastfm-square', 'fa-leaf', 'fa-leanpub', 'fa-legal', 'fa-level-down', 'fa-level-up', 'fa-life-bouy', 'fa-life-ring', 'fa-life-saver', 'fa-lightbulb-o', 'fa-line-chart', 'fa-link', 'fa-linkedin', 'fa-linkedin-square', 'fa-linux', 'fa-list', 'fa-list-alt', 'fa-list-ol', 'fa-list-ul', 'fa-location-arrow', 'fa-lock', 'fa-long-arrow-down', 'fa-long-arrow-left', 'fa-long-arrow-right', 'fa-long-arrow-up', 'fa-magic', 'fa-magnet', 'fa-mail-forward', 'fa-mail-reply', 'fa-mail-reply-all', 'fa-male', 'fa-map-marker', 'fa-map', 'fa-map-double', 'fa-map-stroke', 'fa-map-stroke-h', 'fa-map-stroke-v', 'fa-maxcdn', 'fa-meanpath', 'fa-medium', 'fa-medkit', 'fa-meh-o', 'fa-mercury', 'fa-microphone', 'fa-microphone-slash', 'fa-minus', 'fa-minus-circle', 'fa-minus-square', 'fa-minus-square-o', 'fa-mobile', 'fa-mobile-phone', 'fa-money', 'fa-moon-o', 'fa-mortar-board', 'fa-motorcycle', 'fa-music', 'fa-navicon', 'fa-neuter', 'fa-newspaper-o', 'fa-openid', 'fa-outdents', 'fa-pagelines', 'fa-paint-brush', 'fa-paper-plane', 'fa-paper-plane-o', 'fa-paperclip', 'fa-paragraph', 'fa-paste', 'fa-pause', 'fa-paw', 'fa-paypal', 'fa-pencil', 'fa-pencil-square', 'fa-pencil-square-o', 'fa-phone', 'fa-phone-square', 'fa-photo', 'fa-picture-o', 'fa-pie-chart', 'fa-pied-piper', 'fa-pied-piper-alt', 'fa-pinterest', 'fa-pinterest-p', 'fa-pinterest-square', 'fa-plane', 'fa-play', 'fa-play-circle', 'fa-play-circle-o', 'fa-plug', 'fa-plus', 'fa-plus-circle', 'fa-plus-square', 'fa-plus-square-o', 'fa-power-off', 'fa-print', 'fa-puzzle-piece', 'fa-qq', 'fa-qrcode', 'fa-question', 'fa-question-circle', 'fa-quote-left', 'fa-quote-right', 'fa-ra', 'fa-random', 'fa-rebel', 'fa-recycle', 'fa-reddit', 'fa-reddit-square', 'fa-refresh', 'fa-remove', 'fa-renren', 'fa-reorder', 'fa-repeat', 'fa-reply', 'fa-reply-all', 'fa-retweet', 'fa-rmb', 'fa-road', 'fa-rocket', 'fa-rotate-left', 'fa-rotate-right', 'fa-rouble', 'fa-rss', 'fa-rss-square', 'fa-rub', 'fa-ruble', 'fa-rupee', 'fa-save', 'fa-scissors', 'fa-search', 'fa-search-minus', 'fa-search-plus', 'fa-sellsy', 'fa-send-o', 'fa-server', 'fa-share', 'fa-share-alt', 'fa-share-alt-square', 'fa-share-square', 'fa-share-square-o', 'fa-shekel', 'fa-sheqel', 'fa-shield', 'fa-ship', 'fa-shirtsinbulk', 'fa-shopping-cart', 'fa-sign-in', 'fa-sign-out', 'fa-signal', 'fa-simplybuilt', 'fa-sitemap', 'fa-skyatlas', 'fa-skype', 'fa-slack', 'fa-sliders', 'fa-slideshare', 'fa-smile-o', 'fa-soccer-ball-o', 'fa-sort', 'fa-sort-alpha-asc', 'fa-sort-alpha-desc', 'fa-sort-amount-asc', 'fa-sort-amount-desc', 'fa-sort-asc', 'fa-sort-desc', 'fa-sort-down', 'fa-sort-numeric-asc', 'fa-sort-numeric-desc', 'fa-sort-up', 'fa-soundcloud', 'fa-space-shuttle', 'fa-spinner', 'fa-spoon', 'fa-spotify', 'fa-square', 'fa-square-o', 'fa-stack-exchange', 'fa-stack-overflow', 'fa-star', 'fa-star-half', 'fa-star-half-empty', 'fa-star-half-full', 'fa-star-half-o', 'fa-star-o', 'fa-steam', 'fa-steam-square', 'fa-step-backward', 'fa-step-forward', 'fa-stethoscope', 'fa-stop', 'fa-street-view', 'fa-strikethrough', 'fa-stumbleupon', 'fa-stumbleupon-circle', 'fa-subscript', 'fa-subway', 'fa-suitcase', 'fa-sun-o', 'fa-superscript', 'fa-support', 'fa-table', 'fa-tablet', 'fa-tachometer', 'fa-tag', 'fa-tags', 'fa-tasks', 'fa-taxi', 'fa-tencent-weibo', 'fa-terminal', 'fa-text-height', 'fa-text-width', 'fa-th', 'fa-th-large', 'fa-th-list', 'fa-thumb-tack', 'fa-thumbs-down', 'fa-thumbs-o-down', 'fa-thumbs-o-up', 'fa-thumbs-up', 'fa-ticket', 'fa-times', 'fa-times-circle-o', 'fa-tint', 'fa-toggle-down', 'fa-toggle-down', 'fa-toggle-off', 'fa-toggle-on', 'fa-toggle-right', 'fa-toggle-up', 'fa-train', 'fa-train', 'fa-transgender', 'fa-transgender-alt', 'fa-trash', 'fa-trash-o', 'fa-tree', 'fa-trello', 'fa-trophy', 'fa-truck', 'fa-try', 'fa-tty', 'fa-tumblr', 'fa-tumblr-square', 'fa-turkish-lira', 'fa-twitch', 'fa-twitter-square', 'fa-umbrella', 'fa-underline', 'fa-undo', 'fa-university', 'fa-unlink', 'fa-unlock', 'fa-unlock-alt', 'fa-unsorted', 'fa-upload', 'fa-usd', 'fa-user', 'fa-user-md', 'fa-user-plus', 'fa-user-secret', 'fa-user-times', 'fa-users', 'fa-venus', 'fa-venus-double', 'fa-venus-mars', 'fa-viacoin', 'fa-video-camera', 'fa-vimeo-square', 'fa-vine', 'fa-vk', 'fa-volume-down', 'fa-volume-off', 'fa-volume-up', 'fa-warning', 'fa-wechat', 'fa-weibo', 'fa-weixin', 'fa-whatsapp', 'fa-wheelchair', 'fa-wifi', 'fa-windows', 'fa-won', 'fa-wordpress', 'fa-wrench', 'fa-xing', 'fa-xing-square', 'fa-yahoo', 'fa-yelp', 'fa-yen', 'fa-youtube', 'fa-youtube-play', 'fa-youtube-square'); ?> <p class="description description-wide"> <label for="edit-menu-item-icon-<?php echo esc_attr($item_id); ?> "> <?php echo 'Font Awesome Icon Class'; ?> <br /> <select id="edit-menu-item-icon-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-icon mango-chosen-select" <?php if (esc_attr($item->icon)) { ?> name="menu-item-icon[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-icon[<?php echo esc_attr($item_id); ?> ]" > <option value=""></option> <?php for ($i = 0; $i < count($arr_font); $i++) { echo '<option value="' . esc_attr($arr_font[$i]) . '"'; if ($arr_font[$i] == $item->icon) { echo ' selected="selected" '; } echo ' >' . esc_attr($arr_font[$i]) . '</option>'; } ?> </select> </label> </p> <?php //if ($depth != 1) { ?> <p class="description description-wide"> <label for="edit-menu-item-icon-<?php echo esc_attr($item_id); ?> "> <?php echo 'Font Awesome Icon Postion'; ?> <br /> <select id="edit-menu-item-icon-postion-<?php echo esc_attr($item_id); ?> " <?php if (esc_attr($item->icon_pos)) { ?> name="menu-item-icon_pos[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-icon_pos[<?php echo esc_attr($item_id); ?> ]" > <option value="Left" <?php if (esc_attr($item->icon_pos) == "Left") { echo 'selected="selected"'; } ?> ><?php echo 'Left'; ?> </option> <option value="Right" <?php if (esc_attr($item->icon_pos) == "Right") { echo 'selected="selected"'; } ?> ><?php echo 'Right'; ?> </option> </select> </label> </p> <?php //} ?> <p class="description"> <label for="edit-menu-item-nolink-<?php echo esc_attr($item_id); ?> "> <input type="checkbox" id="edit-menu-item-nolink-<?php echo esc_attr($item_id); ?> " class="code edit-menu-item-custom" value="nolink" <?php if ($item->nolink == 'nolink') { ?> name="menu-item-nolink[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-nolink[<?php echo esc_attr($item_id); ?> ]" <?php checked($item->nolink, 'nolink'); ?> /> <?php echo "Don't link"; ?> </label> </p> <p class="description"> <label for="edit-menu-item-hide-<?php echo esc_attr($item_id); ?> "> <input type="checkbox" id="edit-menu-item-hide-<?php echo esc_attr($item_id); ?> " class="code edit-menu-item-custom" value="hide" <?php if ($item->hide == 'hide') { ?> name="menu-item-hide[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-hide[<?php echo esc_attr($item_id); ?> ]" <?php checked($item->hide, 'hide'); ?> /> <?php echo "Don't show a link"; ?> </label> </p> <p class="description"> <label for="edit-menu-item-mobile_hide-<?php echo esc_attr($item_id); ?> "> <input type="checkbox" id="edit-menu-item-mobile_hide-<?php echo esc_attr($item_id); ?> " class="code edit-menu-item-custom" value="hide" <?php if ($item->mobile_hide == 'hide') { ?> name="menu-item-mobile_hide[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-mobile_hide[<?php echo esc_attr($item_id); ?> ]" <?php checked($item->mobile_hide, 'hide'); ?> /> <?php echo "Don't show a link on mobile panel"; ?> </label> </p> <div class="edit-menu-item-popup-<?php echo esc_attr($item_id); ?> " style="<?php if ($depth == 0) { echo 'display:block;'; } else { echo 'display:none;'; } ?> "> <div style="clear:both;"></div> <p class="description description-thin description-thin-custom"> <label for="edit-menu-item-type-menu-<?php echo esc_attr($item_id); ?> "> <?php echo 'Menu Type'; ?> <br /> <select id="edit-menu-item-type-menu-<?php echo esc_attr($item_id); ?> " <?php if (esc_attr($item->popup_type)) { ?> name="menu-item-popup_type[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-popup_type[<?php echo esc_attr($item_id); ?> ]" > <option value="" <?php if (esc_attr($item->popup_type) == "") { echo 'selected="selected"'; } ?> ><?php echo 'Narrow'; ?> </option> <option value="megamenu-v1" <?php if (esc_attr($item->popup_type) == "megamenu-v1") { echo 'selected="selected"'; } ?> ><?php echo 'Mega Menu V1'; ?> </option> <option value="megamenu-v2" <?php if (esc_attr($item->popup_type) == "megamenu-v2") { echo 'selected="selected"'; } ?> ><?php echo 'Mega Menu V2'; ?> </option> <option value="wide" <?php if (esc_attr($item->popup_type) == "wide") { echo 'selected="selected"'; } ?> ><?php echo 'Wide'; ?> </option> </select> </label> </p> <p class="description description-thin description-thin-custom"> <label for="edit-menu-item-popup_pos-<?php echo esc_attr($item_id); ?> "> <?php echo 'Popup Position'; ?> <br /> <select id="edit-menu-item-popup_pos-<?php echo esc_attr($item_id); ?> " <?php if (esc_attr($item->popup_pos)) { ?> name="menu-item-popup_pos[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-popup_pos[<?php echo esc_attr($item_id); ?> ]" > <option value="popup_left_align" <?php if (esc_attr($item->popup_pos) == "") { echo 'selected="selected"'; } ?> ><?php echo 'Left'; ?> </option> <option value="popup_right_align" <?php if (esc_attr($item->popup_pos) == "popup_right_align") { echo 'selected="selected"'; } ?> ><?php echo 'Right'; ?> </option> <!--<option value="" <?php //if(esc_attr($item->popup_pos) == ""){echo 'selected="selected"';} ?> ><?php //echo 'Justify (only wide)' ?> </option> <option value="pos-center" <?php //if(esc_attr($item->popup_pos) == "pos-center"){echo 'selected="selected"';} ?> ><?php //echo 'Center (only wide)' ?> </option>--> </select> </label> </p> <div style="clear:both;"></div> <p class="description description-wide"> <label for="edit-menu-item-popup_cols-<?php echo esc_attr($item_id); ?> "> <br/><?php echo 'Popup Columns (only wide)'; ?> <br /> <select id="edit-menu-item-popup_cols-<?php echo esc_attr($item_id); ?> " <?php if ($item->popup_cols) { ?> name="menu-item-popup_cols[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-popup_cols[<?php echo esc_attr($item_id); ?> ]" > <option value="col-4" <?php if (esc_attr($item->popup_cols) == "col-4") { echo 'selected="selected"'; } ?> ><?php echo '4 Columns'; ?> </option> <option value="col-3" <?php if (esc_attr($item->popup_cols) == "col-3") { echo 'selected="selected"'; } ?> ><?php echo '3 Columns'; ?> </option> <option value="col-2" <?php if (esc_attr($item->popup_cols) == "col-2") { echo 'selected="selected"'; } ?> ><?php echo '2 Columns'; ?> </option> <option value="col-5" <?php if (esc_attr($item->popup_cols) == "col-5") { echo 'selected="selected"'; } ?> ><?php echo '5 Columns'; ?> </option> <option value="col-6" <?php if (esc_attr($item->popup_cols) == "col-6") { echo 'selected="selected"'; } ?> ><?php echo '6 Columns'; ?> </option> </select> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-popup_bg_image-<?php echo esc_attr($item_id); ?> "> <?php echo 'Popup Background Image (only wide)'; ?> <br /> <input type="text" id="edit-menu-item-popup_bg_image-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-popup_bg_image" <?php if (esc_attr($item->popup_bg_image)) { ?> name="menu-item-popup_bg_image[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-popup_bg_image[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->popup_bg_image); ?> " /> <br/> <input class="button_upload_image button" id="edit-menu-item-popup_bg_image-<?php echo esc_attr($item_id); ?> " type="button" value="Upload Image" /> <input class="button_remove_image button" id="edit-menu-item-popup_bg_image-<?php echo esc_attr($item_id); ?> " type="button" value="Remove Image" /> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-popup_bg_pos-<?php echo esc_attr($item_id); ?> "> <br/><?php echo 'Popup Background Position (only wide)'; ?> <br /> <select id="edit-menu-item-popup_bg_pos-<?php echo esc_attr($item_id); ?> " <?php if ($item->popup_bg_pos) { ?> name="menu-item-popup_bg_pos[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-popup_bg_pos[<?php echo esc_attr($item_id); ?> ]" > <option value="" <?php if (esc_attr($item->popup_bg_pos) == "") { echo 'selected="selected"'; } ?> ><?php echo 'Select'; ?> </option> <option value="left top" <?php if (esc_attr($item->popup_bg_pos) == "left top") { echo 'selected="selected"'; } ?> ><?php echo 'Left Top'; ?> </option> <option value="left center" <?php if (esc_attr($item->popup_bg_pos) == "left center") { echo 'selected="selected"'; } ?> ><?php echo 'Left Center'; ?> </option> <option value="left center" <?php if (esc_attr($item->popup_bg_pos) == "left center") { echo 'selected="selected"'; } ?> ><?php echo 'Left Center'; ?> </option> <option value="left bottom" <?php if (esc_attr($item->popup_bg_pos) == "left bottom") { echo 'selected="selected"'; } ?> ><?php echo 'Left Bottom'; ?> </option> <option value="center top" <?php if (esc_attr($item->popup_bg_pos) == "center top") { echo 'selected="selected"'; } ?> ><?php echo 'Center Top'; ?> </option> <option value="center center" <?php if (esc_attr($item->popup_bg_pos) == "center center") { echo 'selected="selected"'; } ?> ><?php echo 'Center Center'; ?> </option> <option value="center bottom" <?php if (esc_attr($item->popup_bg_pos) == "center bottom") { echo 'selected="selected"'; } ?> ><?php echo 'Center Bottom'; ?> </option> <option value="right top" <?php if (esc_attr($item->popup_bg_pos) == "right top") { echo 'selected="selected"'; } ?> ><?php echo 'Right Top'; ?> </option> <option value="right center" <?php if (esc_attr($item->popup_bg_pos) == "right center") { echo 'selected="selected"'; } ?> ><?php echo 'Right Center'; ?> </option> <option value="right bottom" <?php if (esc_attr($item->popup_bg_pos) == "right bottom") { echo 'selected="selected"'; } ?> ><?php echo 'Right Bottom'; ?> </option> ); </select> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-popup_bg_repeat-<?php echo esc_attr($item_id); ?> "> <br/><?php echo 'Popup Background Repeat (only wide)'; ?> <br /> <select id="edit-menu-item-popup_bg_repeat-<?php echo esc_attr($item_id); ?> " <?php if ($item->popup_bg_repeat) { ?> name="menu-item-popup_bg_repeat[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-popup_bg_repeat[<?php echo esc_attr($item_id); ?> ]" > <option value="" <?php if (esc_attr($item->popup_bg_repeat) == "") { echo 'selected="selected"'; } ?> ><?php echo 'Select'; ?> </option> <option value="no-repeat" <?php if (esc_attr($item->popup_bg_repeat) == "no-repeat") { echo 'selected="selected"'; } ?> ><?php echo 'No Repeat'; ?> </option> <option value="repeat" <?php if (esc_attr($item->popup_bg_repeat) == "repeat") { echo 'selected="selected"'; } ?> ><?php echo 'Repeat All'; ?> </option> <option value="repeat-x" <?php if (esc_attr($item->popup_bg_repeat) == "repeat-x") { echo 'selected="selected"'; } ?> ><?php echo 'Repeat Horizontally'; ?> </option> <option value="repeat-y" <?php if (esc_attr($item->popup_bg_repeat) == "repeat-y") { echo 'selected="selected"'; } ?> ><?php echo 'Repeat Vertically'; ?> </option> <option value="inherit" <?php if (esc_attr($item->popup_bg_repeat) == "inherit") { echo 'selected="selected"'; } ?> ><?php echo 'Inherit'; ?> </option> </select> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-popup_bg_size-<?php echo esc_attr($item_id); ?> "> <br/><?php echo 'Popup Background Size (only wide)'; ?> <br /> <select id="edit-menu-item-popup_bg_size-<?php echo esc_attr($item_id); ?> " <?php if ($item->popup_bg_size) { ?> name="menu-item-popup_bg_size[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-popup_bg_size[<?php echo esc_attr($item_id); ?> ]" > <option value="" <?php if (esc_attr($item->popup_bg_size) == "") { echo 'selected="selected"'; } ?> ><?php echo 'Select'; ?> </option> <option value="inherit" <?php if (esc_attr($item->popup_bg_size) == "inherit") { echo 'selected="selected"'; } ?> ><?php echo 'Inherit'; ?> </option> <option value="cover" <?php if (esc_attr($item->popup_bg_size) == "cover") { echo 'selected="selected"'; } ?> ><?php echo 'Cover'; ?> </option> <option value="contain" <?php if (esc_attr($item->popup_bg_size) == "contain") { echo 'selected="selected"'; } ?> ><?php echo 'Contain'; ?> </option> </select> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-popup_style-<?php echo esc_attr($item_id); ?> "> <?php echo 'Popup Styles (only wide)'; ?> <br /> <textarea id="edit-menu-item-popup_style-<?php echo esc_attr($item_id); ?> " class="widefat edit-menu-item-popup_style" rows="3" cols="20" <?php if (esc_html($item->popup_style)) { ?> name="menu-item-popup_style[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-popup_style[<?php echo esc_attr($item_id); ?> ]" ><?php echo esc_html($item->popup_style); // textarea_escaped ?> </textarea> </label> </p> <br/> </div> <div class="edit-menu-item-block-<?php echo esc_attr($item_id); ?> " style="<?php if ($depth == 1) { echo 'display:block;'; } else { echo 'display:none;'; } ?> "> <div style="clear:both;"></div> <p class="description"> <label for="edit-menu-item-hide_cat_image-<?php echo esc_attr($item_id); ?> "> <input type="checkbox" id="edit-menu-item-hide_cat_image-<?php echo esc_attr($item_id); ?> " class="code edit-menu-item-custom" value="true" <?php if ($item->hide_cat_image == 'true') { ?> name="menu-item-hide_cat_image[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-hide_cat_image[<?php echo esc_attr($item_id); ?> ]" <?php checked($item->hide_cat_image, 'true'); ?> /> <?php echo "Hide Category Image (only Mega Menu V2)"; ?> </label> </p> <p class="description"> <label for="edit-menu-item-hide_subcats_list-<?php echo esc_attr($item_id); ?> "> <input type="checkbox" id="edit-menu-item-hide_subcats_list-<?php echo esc_attr($item_id); ?> " class="code edit-menu-item-custom" value="true" <?php if ($item->hide_subcats_list == 'true') { ?> name="menu-item-hide_subcats_list[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-hide_subcats_list[<?php echo esc_attr($item_id); ?> ]" <?php checked($item->hide_subcats_list, 'true'); ?> /> <?php echo "Hide Sub-Categories List (only Mega Menu V2)"; ?> </label> </p> <p class="description"> <label for="edit-menu-item-hide_empty_subcats-<?php echo esc_attr($item_id); ?> "> <input type="checkbox" id="edit-menu-item-hide_empty_subcats-<?php echo esc_attr($item_id); ?> " class="code edit-menu-item-custom" value="true" <?php if ($item->hide_empty_subcats == 'true') { ?> name="menu-item-hide_empty_subcats[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-hide_empty_subcats[<?php echo esc_attr($item_id); ?> ]" <?php checked($item->hide_empty_subcats, 'true'); ?> /> <?php echo "Hide Empty Sub-Categories (only Mega Menu V2)"; ?> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-cols-<?php echo esc_attr($item_id); ?> "> <?php echo 'Columns (only wide)'; ?> <br /> <input type="text" id="edit-menu-item-cols-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-cols" <?php if (esc_attr($item->cols)) { ?> name="menu-item-cols[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-cols[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->cols ? $item->cols : 1); ?> " /> <span class="description"><?php echo 'will occupy x columns of parent popup columns'; ?> </span> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-subpopup_bg_image-<?php echo esc_attr($item_id); ?> "> <?php echo 'Background Image (only wide)'; ?> <br /> <input type="text" id="edit-menu-item-subpopup_bg_image-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-subpopup_bg_image" <?php if (esc_attr($item->subpopup_bg_image)) { ?> name="menu-item-subpopup_bg_image[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-subpopup_bg_image[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->subpopup_bg_image); ?> " /> <br/> <input class="button_upload_image button" id="edit-menu-item-subpopup_bg_image-<?php echo esc_attr($item_id); ?> " type="button" value="Upload Image" /> <input class="button_remove_image button" id="edit-menu-item-subpopup_bg_image-<?php echo esc_attr($item_id); ?> " type="button" value="Remove Image" /> </label> </p> <?php if ('custom' == $item->type && $depth == 1) { ?> <p class="description"> <label for="edit-menu-item-show_category_img-<?php echo esc_attr($item_id); ?> "> <input type="checkbox" id="edit-menu-item-show_category_img-<?php echo esc_attr($item_id); ?> " class="code edit-menu-item-custom" value="true" <?php if ($item->show_category_img == 'true') { ?> name="menu-item-show_category_img[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-show_category_img[<?php echo esc_attr($item_id); ?> ]" <?php checked($item->show_category_img, 'true'); ?> /> <?php echo "show Category Images"; ?> </label> </p> <?php } ?> <p class="description description-wide"> <label for="edit-menu-item-subpopup_bg_pos-<?php echo esc_attr($item_id); ?> "> <br/><?php echo 'Background Position (only wide)'; ?> <br /> <select id="edit-menu-item-subpopup_bg_pos-<?php echo esc_attr($item_id); ?> " <?php if ($item->subpopup_bg_pos) { ?> name="menu-item-subpopup_bg_pos[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-subpopup_bg_pos[<?php echo esc_attr($item_id); ?> ]" > <option value="" <?php if (esc_attr($item->subpopup_bg_pos) == "") { echo 'selected="selected"'; } ?> ><?php echo 'Select'; ?> </option> <option value="left top" <?php if (esc_attr($item->subpopup_bg_pos) == "left top") { echo 'selected="selected"'; } ?> ><?php echo 'Left Top'; ?> </option> <option value="left center" <?php if (esc_attr($item->subpopup_bg_pos) == "left center") { echo 'selected="selected"'; } ?> ><?php echo 'Left Center'; ?> </option> <option value="left center" <?php if (esc_attr($item->subpopup_bg_pos) == "left center") { echo 'selected="selected"'; } ?> ><?php echo 'Left Center'; ?> </option> <option value="left bottom" <?php if (esc_attr($item->subpopup_bg_pos) == "left bottom") { echo 'selected="selected"'; } ?> ><?php echo 'Left Bottom'; ?> </option> <option value="center top" <?php if (esc_attr($item->subpopup_bg_pos) == "center top") { echo 'selected="selected"'; } ?> ><?php echo 'Center Top'; ?> </option> <option value="center center" <?php if (esc_attr($item->subpopup_bg_pos) == "center center") { echo 'selected="selected"'; } ?> ><?php echo 'Center Center'; ?> </option> <option value="center bottom" <?php if (esc_attr($item->subpopup_bg_pos) == "center bottom") { echo 'selected="selected"'; } ?> ><?php echo 'Center Bottom'; ?> </option> <option value="right top" <?php if (esc_attr($item->subpopup_bg_pos) == "right top") { echo 'selected="selected"'; } ?> ><?php echo 'Right Top'; ?> </option> <option value="right center" <?php if (esc_attr($item->subpopup_bg_pos) == "right center") { echo 'selected="selected"'; } ?> ><?php echo 'Right Center'; ?> </option> <option value="right bottom" <?php if (esc_attr($item->subpopup_bg_pos) == "right bottom") { echo 'selected="selected"'; } ?> ><?php echo 'Right Bottom'; ?> </option> ); </select> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-subpopup_bg_repeat-<?php echo esc_attr($item_id); ?> "> <br/><?php echo 'Background Repeat (only wide)'; ?> <br /> <select id="edit-menu-item-subpopup_bg_repeat-<?php echo esc_attr($item_id); ?> " <?php if ($item->popup_bg_repeat) { ?> name="menu-item-subpopup_bg_repeat[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-subpopup_bg_repeat[<?php echo esc_attr($item_id); ?> ]" > <option value="" <?php if (esc_attr($item->subpopup_bg_repeat) == "") { echo 'selected="selected"'; } ?> ><?php echo 'Select'; ?> </option> <option value="no-repeat" <?php if (esc_attr($item->subpopup_bg_repeat) == "no-repeat") { echo 'selected="selected"'; } ?> ><?php echo 'No Repeat'; ?> </option> <option value="repeat" <?php if (esc_attr($item->subpopup_bg_repeat) == "repeat") { echo 'selected="selected"'; } ?> ><?php echo 'Repeat All'; ?> </option> <option value="repeat-x" <?php if (esc_attr($item->subpopup_bg_repeat) == "repeat-x") { echo 'selected="selected"'; } ?> ><?php echo 'Repeat Horizontally'; ?> </option> <option value="repeat-y" <?php if (esc_attr($item->subpopup_bg_repeat) == "repeat-y") { echo 'selected="selected"'; } ?> ><?php echo 'Repeat Vertically'; ?> </option> <option value="inherit" <?php if (esc_attr($item->subpopup_bg_repeat) == "inherit") { echo 'selected="selected"'; } ?> ><?php echo 'Inherit'; ?> </option> </select> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-subpopup_bg_size-<?php echo esc_attr($item_id); ?> "> <br/><?php echo 'Background Size (only wide)'; ?> <br /> <select id="edit-menu-item-subpopup_bg_size-<?php echo esc_attr($item_id); ?> " <?php if ($item->popup_bg_size) { ?> name="menu-item-subpopup_bg_size[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-subpopup_bg_size[<?php echo esc_attr($item_id); ?> ]" > <option value="" <?php if (esc_attr($item->subpopup_bg_size) == "") { echo 'selected="selected"'; } ?> ><?php echo 'Select'; ?> </option> <option value="inherit" <?php if (esc_attr($item->subpopup_bg_size) == "inherit") { echo 'selected="selected"'; } ?> ><?php echo 'Inherit'; ?> </option> <option value="cover" <?php if (esc_attr($item->subpopup_bg_size) == "cover") { echo 'selected="selected"'; } ?> ><?php echo 'Cover'; ?> </option> <option value="contain" <?php if (esc_attr($item->subpopup_bg_size) == "contain") { echo 'selected="selected"'; } ?> ><?php echo 'Contain'; ?> </option> </select> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-subpopup_style-<?php echo esc_attr($item_id); ?> "> <?php echo 'Custom Styles (only wide)'; ?> <br /> <textarea id="edit-menu-item-subpopup_style-<?php echo esc_attr($item_id); ?> " class="widefat edit-menu-item-popup_style" rows="3" cols="20" <?php if (esc_html($item->subpopup_style)) { ?> name="menu-item-subpopup_style[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-subpopup_style[<?php echo esc_attr($item_id); ?> ]" ><?php echo esc_html($item->subpopup_style); // textarea_escaped ?> </textarea> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-block-<?php echo esc_attr($item_id); ?> "> <?php echo 'Block Slug'; ?> <br /> <input type="text" id="edit-menu-item-poup_block-<?php echo esc_attr($item_id); ?> " class="widefat edit-menu-item-block" <?php if (esc_attr($item->block)) { ?> name="menu-item-block[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-block[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->block); // textarea_escaped ?> "/> </label> </p> </div> <p class="description description-thin"> <label for="edit-menu-item-tip_label-<?php echo esc_attr($item_id); ?> "> <?php echo 'Tip Label'; ?> <br /> <input type="text" id="edit-menu-item-tip_label-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-tip_label" <?php if (esc_attr($item->tip_label)) { ?> name="menu-item-tip_label[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-tip_label[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->tip_label); ?> " /> </label> </p> <p class="description description-thin"> <label for="edit-menu-item-tip_color-<?php echo esc_attr($item_id); ?> "> <?php echo 'Tip Text Color'; ?> <br /> <input type="text" id="edit-menu-item-tip_color-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-tip_color" <?php if (esc_attr($item->tip_color)) { ?> name="menu-item-tip_color[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-tip_color[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->tip_color); ?> " /> </label> </p> <p class="description description-thin"> <label for="edit-menu-item-tip_bg-<?php echo esc_attr($item_id); ?> "> <?php echo 'Tip BG Color'; ?> <br /> <input type="text" id="edit-menu-item-tip_bg-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-tip_bg" <?php if (esc_attr($item->tip_bg)) { ?> name="menu-item-tip_bg[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-tip_bg[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->tip_bg); ?> " /> </label> </p><br/> <?php /* New fields insertion ends here */ ?> <div style="clear:both;"></div><br/> <p class="description description-wide"> <label for="edit-menu-item-attr-title-<?php echo esc_attr($item_id); ?> "> <?php echo 'Title Attribute'; ?> <br /> <input type="text" id="edit-menu-item-attr-title-<?php echo esc_attr($item_id); ?> " class="widefat edit-menu-item-attr-title" <?php if (esc_attr($item->post_excerpt)) { ?> name="menu-item-attr-title[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-attr-title[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->post_excerpt); ?> " /> </label> </p> <p class="description description-thin"> <label for="edit-menu-item-classes-<?php echo esc_attr($item_id); ?> "> <?php echo 'CSS Classes (optional)'; ?> <br /> <input type="text" id="edit-menu-item-classes-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-classes" <?php if (esc_attr(implode(' ', $item->classes))) { ?> name="menu-item-classes[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-classes[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr(implode(' ', $item->classes)); ?> " /> </label> </p> <p class="description description-thin"> <label for="edit-menu-item-xfn-<?php echo esc_attr($item_id); ?> "> <?php echo 'Link Relationship (XFN)'; ?> <br /> <input type="text" id="edit-menu-item-xfn-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-xfn" <?php if (esc_attr($item->xfn)) { ?> name="menu-item-xfn[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-xfn[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->xfn); ?> " /> </label> </p> <p class="description description-wide"> <label for="edit-menu-item-description-<?php echo esc_attr($item_id); ?> "> <?php echo 'Description'; ?> <br /> <textarea id="edit-menu-item-description-<?php echo esc_attr($item_id); ?> " class="widefat edit-menu-item-description" rows="3" cols="20" <?php if (esc_html($item->description)) { ?> name="menu-item-description[<?php echo esc_attr($item_id); ?> ]" <?php } ?> data-name="menu-item-description[<?php echo esc_attr($item_id); ?> ]" ><?php echo esc_html($item->description); // textarea_escaped ?> </textarea> <span class="description"><?php echo 'The description will be displayed in the menu if the current theme supports it.'; ?> </span> </label> </p> <div class="menu-item-actions description-wide submitbox"> <?php if ('custom' != $item->type && $original_title !== false) { ?> <p class="link-to-original"> <?php printf('Original: %s', '<a href="' . esc_url($item->url) . '">' . esc_html($original_title) . '</a>'); ?> </p> <?php } ?> <a class="item-delete submitdelete deletion" id="delete-<?php echo esc_attr($item_id); ?> " href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'delete-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'delete-menu_item_' . $item_id); ?> "><?php echo 'Remove'; ?> </a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php echo esc_attr($item_id); ?> " href="<?php echo esc_url(add_query_arg(array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg($removed_args, admin_url('nav-menus.php')))); ?> #menu-item-settings-<?php echo esc_attr($item_id); ?> "><?php echo 'Cancel'; ?> </a> </div> <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item_id); ?> " /> <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->object_id); ?> " /> <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->object); ?> " /> <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->menu_item_parent); ?> " /> <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->menu_order); ?> " /> <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->type); ?> " /> </div><!-- .menu-item-settings--> <ul class="menu-item-transport"></ul> </li> <?php $output .= ob_get_clean(); }
/** * @see Walker::start_el() * @since 3.0.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param object $args */ function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0) { global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; $indent = $depth ? str_repeat("\t", $depth) : ''; ob_start(); $item_id = esc_attr($item->ID); $removed_args = array('action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce'); $original_title = ''; if ('taxonomy' == $item->type) { $original_title = get_term_field('name', $item->object_id, $item->object, 'raw'); if (is_wp_error($original_title)) { $original_title = false; } } elseif ('post_type' == $item->type) { $original_object = get_post($item->object_id); $original_title = $original_object->post_title; } $classes = array('menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr($item->object), 'menu-item-edit-' . (isset($_GET['edit-menu-item']) && $item_id == $_GET['edit-menu-item'] ? 'active' : 'inactive')); $title = $item->title; if (!empty($item->_invalid)) { $classes[] = 'menu-item-invalid'; /* translators: %s: title of menu item which is invalid */ $title = sprintf(__('%s (Invalid)', 'fptcity'), $item->title); } elseif (isset($item->post_status) && 'draft' == $item->post_status) { $classes[] = 'pending'; /* translators: %s: title of menu item in draft status */ $title = sprintf(__('%s (Pending)', 'fptcity'), $item->title); } $title = empty($item->label) ? $title : $item->label; ?> <li data-menuanchor="" id="menu-item-<?php echo esc_attr($item_id); ?> " class="<?php echo esc_attr(implode(' ', $classes)); ?> "> <dl class="menu-item-bar"> <dt class="menu-item-handle"> <span class="item-title"><?php echo esc_html($title); ?> </span> <span class="item-controls"> <span class="item-type"><?php echo esc_html($item->type_label); ?> </span> <span class="item-order hide-if-js"> <a href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'move-up-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'); ?> " class="item-move-up"><abbr title="<?php esc_attr_e('Move up', 'fptcity'); ?> ">↑</abbr></a> | <a href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'move-down-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'move-menu_item'); ?> " class="item-move-down"><abbr title="<?php esc_attr_e('Move down', 'fptcity'); ?> ">↓</abbr></a> </span> <a class="item-edit" id="edit-<?php echo esc_attr($item_id); ?> " title="<?php esc_attr_e('Edit Menu Item', 'fptcity'); ?> " href="<?php 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-' . do_shortcode($item_id)))); ?> "><?php _e('Edit Menu Item', 'fptcity'); ?> </a> </span> </dt> </dl> <div class="menu-item-settings" id="menu-item-settings-<?php echo esc_attr($item_id); ?> "> <?php if ('custom' == $item->type) { ?> <p class="field-url description description-wide"> <label for="edit-menu-item-url-<?php echo esc_attr($item_id); ?> "> <?php _e('URL', 'fptcity'); ?> <br /> <input type="text" id="edit-menu-item-url-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->url); ?> " /> </label> </p> <?php } ?> <p class="description description-thin"> <label for="edit-menu-item-title-<?php echo esc_attr($item_id); ?> "> <?php _e('Navigation Label', 'fptcity'); ?> <br /> <input type="text" id="edit-menu-item-title-<?php echo esc_attr($item_id); ?> " class="widefat edit-menu-item-title" name="menu-item-title[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->title); ?> " /> </label> </p> <p class="description description-thin"> <label for="edit-menu-item-attr-title-<?php echo esc_attr($item_id); ?> "> <?php _e('Title Attribute', 'fptcity'); ?> <br /> <input type="text" id="edit-menu-item-attr-title-<?php echo esc_attr($item_id); ?> " class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->post_excerpt); ?> " /> </label> </p> <p class="field-link-target description"> <label for="edit-menu-item-target-<?php echo esc_attr($item_id); ?> "> <input type="checkbox" id="edit-menu-item-target-<?php echo esc_attr($item_id); ?> " value="_blank" name="menu-item-target[<?php echo esc_attr($item_id); ?> ]"<?php checked($item->target, '_blank'); ?> /> <?php _e('Open link in a new window/tab', 'fptcity'); ?> </label> </p> <p class="field-css-classes description description-thin"> <label for="edit-menu-item-classes-<?php echo esc_attr($item_id); ?> "> <?php _e('CSS Classes (optional)', 'fptcity'); ?> <br /> <input type="text" id="edit-menu-item-classes-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr(implode(' ', $item->classes)); ?> " /> </label> </p> <p class="field-xfn description description-thin"> <label for="edit-menu-item-xfn-<?php echo esc_attr($item_id); ?> "> <?php _e('Link Relationship (XFN)', 'fptcity'); ?> <br /> <input type="text" id="edit-menu-item-xfn-<?php echo esc_attr($item_id); ?> " class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->xfn); ?> " /> </label> </p> <p class="field-description description description-wide"> <label for="edit-menu-item-description-<?php echo esc_attr($item_id); ?> "> <?php _e('Description', 'fptcity'); ?> <br /> <textarea id="edit-menu-item-description-<?php echo esc_attr($item_id); ?> " class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo esc_attr($item_id); ?> ]"><?php echo esc_html($item->description); ?> </textarea> <span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.', 'fptcity'); ?> </span> </label> </p> <?php /* * This is the added field */ $title = 'Extra Class'; $key = "menu-item-el_class"; $value = $item->el_class; ?> <p class="description description-wide description_width_100"> <label for="edit-<?php echo esc_attr($key . '-' . $item_id); ?> "> <span class='obtheme_long_desc'><?php echo do_shortcode($title); ?> </span><br /> <input type="text" value="<?php echo esc_attr($value); ?> " id="edit-<?php echo esc_attr($key) . '-' . esc_attr($item_id); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr($key) . "[" . esc_attr($item_id) . "]"; ?> " /> </label> </p> <?php /* * This is the added field */ if (!$depth) { $title = 'Submenu Type'; $key = "menu-item-submenu_type"; $value = $item->submenu_type; ?> <p class="description description-wide description_width_100"> <?php echo do_shortcode($title); ?> <br /> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <select id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id)) . "]"; ?> "> <option value="standard" <?php echo esc_attr($value == 'standard' ? ' selected="selected" ' : ''); ?> ><?php _e('Standard Dropdown', 'fptcity'); ?> </option> <option value="columns2" <?php echo esc_attr($value == 'columns2' ? ' selected="selected" ' : ''); ?> ><?php _e('2 columns dropdown', 'fptcity'); ?> </option> <option value="columns3" <?php echo esc_attr($value == 'columns3' ? ' selected="selected" ' : ''); ?> ><?php _e('3 columns dropdown', 'fptcity'); ?> </option> <option value="columns4" <?php echo esc_attr($value == 'columns4' ? ' selected="selected" ' : ''); ?> ><?php _e('4 columns dropdown', 'fptcity'); ?> </option> <option value="columns5" <?php echo esc_attr($value == 'columns5' ? ' selected="selected" ' : ''); ?> ><?php _e('5 columns dropdown', 'fptcity'); ?> </option> </select> </label> </p> <?php $title = 'Sub menu column width ( Example: 200)'; $key = "menu-item-column_width"; $value = $item->column_width; ?> <p class="description description-wide obtheme_checkbox obtheme_mega_menu obtheme_mega_menu_d2"> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <span class='obtheme_long_desc'><?php echo do_shortcode($title); ?> </span><br /> <input type="text" value="<?php echo esc_attr($value); ?> " id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> " /> </label> </p> <?php $title = 'Side of Dropdown Elements'; $key = "menu-item-dropdown"; $value = $item->dropdown; ?> <p class="description description-wide description_width_100"> <?php echo do_shortcode($title); ?> <br /> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <select id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> "> <option value="autodrop_submenu" <?php echo esc_attr($value == 'autodrop_submenu' ? ' selected="selected" ' : ''); ?> ><?php _e('Auto drop', 'fptcity'); ?> </option> <option value="drop_to_left" <?php echo esc_attr($value == 'drop_to_left' ? ' selected="selected" ' : ''); ?> ><?php _e('Drop To Left Side', 'fptcity'); ?> </option> <option value="drop_to_right" <?php echo esc_attr($value == 'drop_to_right' ? ' selected="selected" ' : ''); ?> ><?php _e('Drop To Right Side', 'fptcity'); ?> </option> <option value="drop_to_center" <?php echo esc_attr($value == 'drop_to_center' ? ' selected="selected" ' : ''); ?> ><?php _e('Drop To Center', 'fptcity'); ?> </option> <option value="drop_full_width" <?php echo esc_attr($value == 'drop_full_width' ? ' selected="selected" ' : ''); ?> ><?php _e('Full width', 'fptcity'); ?> </option> </select> </label> </p> <?php } if ($depth) { $title = 'Widget Area'; $key = "menu-item-widget_area"; $value = $item->widget_area; $sidebars = $GLOBALS['wp_registered_sidebars']; ?> <p class="description description-wide description_width_100 el_widget_area"> <?php echo do_shortcode($title); ?> <br /> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <select id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> "> <option value="" <?php echo esc_attr($value == '' ? ' selected="selected" ' : ''); ?> ><?php _e('Select Widget Area', 'fptcity'); ?> </option> <?php foreach ($sidebars as $sidebar) { echo '<option value="' . esc_attr($sidebar['id']) . '" ' . esc_attr($value == $sidebar['id'] ? ' selected="selected" ' : '') . '>[' . esc_attr($sidebar['id']) . '] - ' . esc_attr($sidebar['name']) . '</option>'; } ?> </select> </label> </p> <?php } $title = 'Group'; $key = "menu-item-group"; $value = $item->group; ?> <p class="description description-wide description_width_100"> <?php echo do_shortcode($title); ?> <br /> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <select id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> "> <option value="no_group" <?php echo esc_attr($value == 'no_group' ? ' selected="selected" ' : ''); ?> ><?php _e('No', 'fptcity'); ?> </option> <option value="group" <?php echo esc_attr($value == 'group' ? ' selected="selected" ' : ''); ?> ><?php _e('Yes', 'fptcity'); ?> </option> </select> </label> </p> <?php if ($depth) { $title = 'Hide title'; $key = "menu-item-hide_link"; $value = $item->hide_link; ?> <p class="description description-wide description_width_100"> <?php echo do_shortcode($title); ?> <br /> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <select id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> "> <option value="0" <?php echo esc_attr($value == '0' ? ' selected="selected" ' : ''); ?> ><?php _e('No', 'fptcity'); ?> </option> <option value="1" <?php echo esc_attr($value == '1' ? ' selected="selected" ' : ''); ?> ><?php _e('Yes', 'fptcity'); ?> </option> </select> </label> </p> <?php } $title = 'Menu Icon'; $key = "menu-item-menu_icon"; $value = $item->menu_icon; ?> <div id="<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id) . '-popup'); ?> " data-item_id="<?php echo esc_attr($item_id); ?> " class="menu_icon_wrap" style="display:none;"> <?php $icons = array('adjust', 'adn', 'align-center', 'align-justify', 'align-left', 'align-right', 'ambulance', 'anchor', 'android', 'angle-double-down', 'angle-double-left', 'angle-double-right', 'angle-double-up', 'angle-down', 'angle-left', 'angle-right', 'angle-up', 'apple', 'archive', 'arrow-circle-down', 'arrow-circle-left', 'arrow-circle-o-down', 'arrow-circle-o-left', 'arrow-circle-o-right', 'arrow-circle-o-up', 'arrow-circle-right', 'arrow-circle-up', 'arrow-down', 'arrow-left', 'arrow-right', 'arrow-up', 'arrows', 'arrows-alt', 'arrows-h', 'arrows-v', 'asterisk', 'automobile', 'backward', 'ban', 'bank', 'bar-chart-o', 'barcode', 'bars', 'beer', 'behance', 'behance-square', 'bell', 'bell-o', 'bitbucket', 'bitbucket-square', 'bitcoin', 'bold', 'bolt', 'bomb', 'book', 'bookmark', 'bookmark-o', 'briefcase', 'btc', 'bug', 'building', 'building-o', 'bullhorn', 'bullseye', 'cab', 'calendar', 'calendar-o', 'camera', 'camera-retro', 'car', 'caret-down', 'caret-left', 'caret-right', 'caret-square-o-down', 'caret-square-o-left', 'caret-square-o-right', 'caret-square-o-up', 'caret-up', 'certificate', 'chain', 'chain-broken', 'check', 'check-circle', 'check-circle-o', 'check-square', 'check-square-o', 'chevron-circle-down', 'chevron-circle-left', 'chevron-circle-right', 'chevron-circle-up', 'chevron-down', 'chevron-left', 'chevron-right', 'chevron-up', 'child', 'circle', 'circle-o', 'circle-o-notch', 'circle-thin', 'clipboard', 'clock-o', 'cloud', 'cloud-download', 'cloud-upload', 'cny', 'code', 'code-fork', 'codepen', 'coffee', 'cog', 'cogs', 'columns', 'comment', 'comment-o', 'comments', 'comments-o', 'compass', 'compress', 'copy', 'credit-card', 'crop', 'crosshairs', 'css3', 'cube', 'cubes', 'cut', 'cutlery', 'dashboard', 'database', 'dedent', 'delicious', 'desktop', 'deviantart', 'digg', 'dollar', 'dot-circle-o', 'download', 'dribbble', 'dropbox', 'drupal', 'edit', 'eject', 'ellipsis-h', 'ellipsis-v', 'empire', 'envelope', 'envelope-o', 'envelope-square', 'eraser', 'eur', 'euro', 'exchange', 'exclamation', 'exclamation-circle', 'exclamation-triangle', 'expand', 'external-link', 'external-link-square', 'eye', 'eye-slash', 'facebook', 'facebook-square', 'fast-backward', 'fast-forward', 'fax', 'female', 'fighter-jet', 'file', 'file-archive-o', 'file-audio-o', 'file-code-o', 'file-excel-o', 'file-image-o', 'file-movie-o', 'file-o', 'file-pdf-o', 'file-photo-o', 'file-picture-o', 'file-powerpoint-o', 'file-sound-o', 'file-text', 'file-text-o', 'file-video-o', 'file-word-o', 'file-zip-o', 'files-o', 'film', 'filter', 'fire', 'fire-extinguisher', 'flag', 'flag-checkered', 'flag-o', 'flash', 'flask', 'flickr', 'floppy-o', 'folder', 'folder-o', 'folder-open', 'folder-open-o', 'font', 'forward', 'foursquare', 'frown-o', 'gamepad', 'gavel', 'gbp', 'ge', 'gear', 'gears', 'gift', 'git', 'git-square', 'github', 'github-alt', 'github-square', 'gittip', 'glass', 'globe', 'google', 'google-plus', 'google-plus-square', 'graduation-cap', 'group', 'h-square', 'hacker-news', 'hand-o-down', 'hand-o-left', 'hand-o-right', 'hand-o-up', 'hdd-o', 'header', 'headphones', 'heart', 'heart-o', 'history', 'home', 'hospital-o', 'html5', 'image', 'inbox', 'indent', 'info', 'info-circle', 'inr', 'instagram', 'institution', 'italic', 'joomla', 'jpy', 'jsfiddle', 'key', 'keyboard-o', 'krw', 'language', 'laptop', 'leaf', 'legal', 'lemon-o', 'level-down', 'level-up', 'life-bouy', 'life-ring', 'life-saver', 'lightbulb-o', 'link', 'linkedin', 'linkedin-square', 'linux', 'list', 'list-alt', 'list-ol', 'list-ul', 'location-arrow', 'lock', 'long-arrow-down', 'long-arrow-left', 'long-arrow-right', 'long-arrow-up', 'magic', 'magnet', 'mail-forward', 'mail-reply', 'mail-reply-all', 'male', 'map-marker', 'maxcdn', 'medkit', 'meh-o', 'microphone', 'microphone-slash', 'minus', 'minus-circle', 'minus-square', 'minus-square-o', 'mobile', 'mobile-phone', 'money', 'moon-o', 'mortar-board', 'music', 'navicon', 'openid', 'outdent', 'pagelines', 'paper-plane', 'paper-plane-o', 'paperclip', 'paragraph', 'paste', 'pause', 'paw', 'pencil', 'pencil-square', 'pencil-square-o', 'phone', 'phone-square', 'photo', 'picture-o', 'pied-piper', 'pied-piper-alt', 'pied-piper-square', 'pinterest', 'pinterest-square', 'plane', 'play', 'play-circle', 'play-circle-o', 'plus', 'plus-circle', 'plus-square', 'plus-square-o', 'power-off', 'print', 'puzzle-piece', 'qq', 'qrcode', 'question', 'question-circle', 'quote-left', 'quote-right', 'ra', 'random', 'rebel', 'recycle', 'reddit', 'reddit-square', 'refresh', 'renren', 'reorder', 'repeat', 'reply', 'reply-all', 'retweet', 'rmb', 'road', 'rocket', 'rotate-left', 'rotate-right', 'rouble', 'rss', 'rss-square', 'rub', 'ruble', 'rupee', 'save', 'scissors', 'search', 'search-minus', 'search-plus', 'send', 'send-o', 'share', 'share-alt', 'share-alt-square', 'share-square', 'share-square-o', 'shield', 'shopping-cart', 'sign-in', 'sign-out', 'signal', 'sitemap', 'skype', 'slack', 'sliders', 'smile-o', 'sort', 'sort-alpha-asc', 'sort-alpha-desc', 'sort-amount-asc', 'sort-amount-desc', 'sort-asc', 'sort-desc', 'sort-down', 'sort-numeric-asc', 'sort-numeric-desc', 'sort-up', 'soundcloud', 'space-shuttle', 'spinner', 'spoon', 'spotify', 'square', 'square-o', 'stack-exchange', 'stack-overflow', 'star', 'star-half', 'star-half-empty', 'star-half-full', 'star-half-o', 'star-o', 'steam', 'steam-square', 'step-backward', 'step-forward', 'stethoscope', 'stop', 'strikethrough', 'stumbleupon', 'stumbleupon-circle', 'subscript', 'suitcase', 'sun-o', 'superscript', 'support', 'table', 'tablet', 'tachometer', 'tag', 'tags', 'tasks', 'taxi', 'tencent-weibo', 'terminal', 'text-height', 'text-width', 'th', 'th-large', 'th-list', 'thumb-tack', 'thumbs-down', 'thumbs-o-down', 'thumbs-o-up', 'thumbs-up', 'ticket', 'times', 'times-circle', 'times-circle-o', 'tint', 'toggle-down', 'toggle-left', 'toggle-right', 'toggle-up', 'trash-o', 'tree', 'trello', 'trophy', 'truck', 'try', 'tumblr', 'tumblr-square', 'turkish-lira', 'twitter', 'twitter-square', 'umbrella', 'underline', 'undo', 'university', 'unlink', 'unlock', 'unlock-alt', 'unsorted', 'upload', 'usd', 'user', 'user-md', 'users', 'video-camera', 'vimeo-square', 'vine', 'vk', 'volume-down', 'volume-off', 'volume-up', 'warning', 'wechat', 'weibo', 'weixin', 'wheelchair', 'windows', 'won', 'wordpress', 'wrench', 'xing', 'xing-square', 'yahoo', 'yen', 'youtube', 'youtube-play', 'youtube-square'); $html = '<input type="hidden" name="" class="wpb_vc_param_value" value="' . esc_attr($value) . '" id="trace"/> '; $html .= '<div class="icon-preview icon-preview-' . esc_attr($item_id) . '"><i class=" fa fa-' . esc_attr($value) . '"></i></div>'; $html .= '<div id="' . esc_attr($key) . '-' . esc_attr($item_id) . '-icon-dropdown" >'; $html .= '<ul class="icon-list">'; $n = 1; foreach ($icons as $icon) { $selected = $icon == $value ? 'class="selected"' : ''; $id = 'icon-' . do_shortcode($n); $html .= '<li ' . esc_attr($selected) . ' data-icon="' . esc_attr($icon) . '"><i class="icon fa fa-' . esc_attr($icon) . '"></i></li>'; $n++; } $html .= '</ul>'; $html .= '</div>'; echo do_shortcode($html); ?> </div> <p class="description description-wide obtheme_checkbox obtheme_mega_menu obtheme_mega_menu_d1"> <label for="edit-<?php echo esc_attr($key . '-' . $item_id); ?> "> <?php echo do_shortcode($title); ?> <br /> <input type="text" value="<?php echo esc_attr($value); ?> " id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> " /> <input alt="#TB_inline?height=400&width=500&inlineId=<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id) . '-popup'); ?> " title="<?php _e('Click to browse icon', 'fptcity'); ?> " class="thickbox button-secondary submit-add-to-menu" type="button" value="<?php _e('Browse Icon', 'fptcity'); ?> " /> <a class="button btn_clear button-primary" href="javascript: void(0);">Clear</a> <span class="icon-preview icon-preview<?php echo esc_attr('-' . do_shortcode($item_id)); ?> "><i class=" fa fa-<?php echo esc_attr($value); ?> "></i></span> </label> </p> <!-- Start background menu --> <?php if (!$depth) { $title = 'DropDown Background Image'; $key = "menu-item-bg_image"; $value = $item->bg_image; ?> <p class="description description-wide obtheme_checkbox obtheme_mega_menu obtheme_mega_menu_d2"> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <span class='obtheme_long_desc'><?php echo do_shortcode($title); ?> </span><br /> <input type="text" value="<?php echo esc_attr($value); ?> " id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> " /> <button id="browse-edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class="set_custom_images button button-secondary submit-add-to-menu"><?php _e('Browse Image', 'fptcity'); ?> </button> <a class="button btn_clear button-primary" href="javascript: void(0);"><?php _e('Clear', 'fptcity'); ?> </a> </label> </p> <p class="description description-wide description_width_25"> <?php $key = "menu-item-bg_image_repeat"; $value = $item->bg_image_repeat; $options = array('repeat', 'no-repeat', 'repeat-x', 'repeat-y'); ?> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <select id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> "> <?php foreach ($options as $option) { ?> <option value="<?php echo esc_attr($option); ?> " <?php echo esc_attr($value == $option ? ' selected="selected" ' : ''); ?> ><?php echo do_shortcode($option); ?> </option> <?php } ?> </select> </label> <?php $key = "menu-item-bg_image_attachment"; $value = $item->bg_image_attachment; $options = array('scroll', 'fixed'); ?> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <select id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> "> <?php foreach ($options as $option) { ?> <option value="<?php echo esc_attr($option); ?> " <?php echo esc_attr($value == $option ? ' selected="selected" ' : ''); ?> ><?php echo do_shortcode($option); ?> </option> <?php } ?> </select> </label> <?php $key = "menu-item-bg_image_position"; $value = $item->bg_image_position; $options = array('center', 'center left', 'center right', 'top left', 'top center', 'top right', 'bottom left', 'bottom center', 'bottom right'); ?> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <select id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> "> <?php foreach ($options as $option) { ?> <option value="<?php echo esc_attr($option); ?> " <?php echo esc_attr($value == $option ? ' selected="selected" ' : ''); ?> ><?php echo do_shortcode($option); ?> </option> <?php } ?> </select> </label> <?php $key = "menu-item-bg_image_size"; $value = $item->bg_image_size; $options = array("auto" => "Keep original", "100% auto" => "Stretch to width", "auto 100%" => "Stretch to height", "cover" => "cover", "contain" => "contain"); ?> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <select id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> "> <?php foreach ($options as $op_value => $op_text) { ?> <option value="<?php echo esc_attr($op_value); ?> " <?php echo esc_attr($value == $op_value ? ' selected="selected" ' : ''); ?> ><?php echo do_shortcode($op_text); ?> </option> <?php } ?> </select> </label> </p> <?php $title = 'Background Color'; $key = "menu-item-bg_color"; $value = $item->bg_color; ?> <p class="description description-wide"> <label for="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> "> <span class='obtheme_long_desc'><?php echo do_shortcode($title); ?> </span><br /> <input type="text" value="<?php echo esc_attr($value); ?> " id="edit-<?php echo esc_attr(do_shortcode($key) . '-' . do_shortcode($item_id)); ?> " class=" <?php echo esc_attr($key); ?> " name="<?php echo esc_attr(do_shortcode($key) . "[" . do_shortcode($item_id) . "]"); ?> " /> </label> </p> <?php } ?> <!-- End background menu --> <div class="menu-item-actions description-wide submitbox"> <?php if ('custom' != $item->type && $original_title !== false) { ?> <p class="link-to-original"> <?php printf(__('Original: %s', 'fptcity'), '<a href="' . esc_attr($item->url) . '">' . esc_html($original_title) . '</a>'); ?> </p> <?php } ?> <a class="item-delete submitdelete deletion" id="delete-<?php echo esc_attr($item_id); ?> " href="<?php echo wp_nonce_url(add_query_arg(array('action' => 'delete-menu-item', 'menu-item' => $item_id), remove_query_arg($removed_args, admin_url('nav-menus.php'))), 'delete-menu_item_' . do_shortcode($item_id)); ?> "><?php _e('Remove', 'fptcity'); ?> </a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php echo esc_attr($item_id); ?> " href="<?php echo esc_url(add_query_arg(array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg($removed_args, admin_url('nav-menus.php')))); ?> #menu-item-settings-<?php echo esc_attr($item_id); ?> "><?php _e('Cancel', 'fptcity'); ?> </a> </div> <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item_id); ?> " /> <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->object_id); ?> " /> <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->object); ?> " /> <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->menu_item_parent); ?> " /> <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->menu_order); ?> " /> <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo esc_attr($item_id); ?> ]" value="<?php echo esc_attr($item->type); ?> " /> </div><!-- .menu-item-settings--> <ul class="menu-item-transport"></ul> <?php $output .= ob_get_clean(); }
/** * Decorates a menu item object with the shared navigation menu item properties. * * Properties: * - db_id: The DB ID of this item as a nav_menu_item object, if it exists (0 if it doesn't exist). * - object_id: The DB ID of the original object this menu item represents, e.g. ID for posts and term_id for categories. * - type: The family of objects originally represented, such as "post_type" or "taxonomy." * - object: The type of object originally represented, such as "category," "post", or "attachment." * - type_label: The singular label used to describe this type of menu item. * - post_parent: The DB ID of the original object's parent object, if any (0 otherwise). * - menu_item_parent: The DB ID of the nav_menu_item that is this item's menu parent, if any. 0 otherwise. * - url: The URL to which this menu item points. * - title: The title of this menu item. * - target: The target attribute of the link element for this menu item. * - attr_title: The title attribute of the link element for this menu item. * - classes: The array of class attribute values for the link element of this menu item. * - xfn: The XFN relationship expressed in the link of this menu item. * - description: The description of this menu item. * * @since 3.0.0 * * @param object $menu_item The menu item to modify. * @return object $menu_item The menu item with standard menu item properties. */ function wp_setup_nav_menu_item($menu_item) { if (isset($menu_item->post_type)) { if ('nav_menu_item' == $menu_item->post_type) { $menu_item->db_id = (int) $menu_item->ID; $menu_item->menu_item_parent = empty($menu_item->menu_item_parent) ? get_post_meta($menu_item->ID, '_menu_item_menu_item_parent', true) : $menu_item->menu_item_parent; $menu_item->object_id = empty($menu_item->object_id) ? get_post_meta($menu_item->ID, '_menu_item_object_id', true) : $menu_item->object_id; $menu_item->object = empty($menu_item->object) ? get_post_meta($menu_item->ID, '_menu_item_object', true) : $menu_item->object; $menu_item->type = empty($menu_item->type) ? get_post_meta($menu_item->ID, '_menu_item_type', true) : $menu_item->type; if ('post_type' == $menu_item->type) { $object = get_post_type_object($menu_item->object); if ($object) { $menu_item->type_label = $object->labels->singular_name; } else { $menu_item->type_label = $menu_item->object; $menu_item->_invalid = true; } $menu_item->url = get_permalink($menu_item->object_id); $original_object = get_post($menu_item->object_id); $original_title = $original_object->post_title; $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; } elseif ('taxonomy' == $menu_item->type) { $object = get_taxonomy($menu_item->object); if ($object) { $menu_item->type_label = $object->labels->singular_name; } else { $menu_item->type_label = $menu_item->object; $menu_item->_invalid = true; } $term_url = get_term_link((int) $menu_item->object_id, $menu_item->object); $menu_item->url = !is_wp_error($term_url) ? $term_url : ''; $original_title = get_term_field('name', $menu_item->object_id, $menu_item->object, 'raw'); if (is_wp_error($original_title)) { $original_title = false; } $menu_item->title = '' == $menu_item->post_title ? $original_title : $menu_item->post_title; } else { $menu_item->type_label = __('Custom'); $menu_item->title = $menu_item->post_title; $menu_item->url = empty($menu_item->url) ? get_post_meta($menu_item->ID, '_menu_item_url', true) : $menu_item->url; } $menu_item->target = empty($menu_item->target) ? get_post_meta($menu_item->ID, '_menu_item_target', true) : $menu_item->target; /** * Filter a navigation menu item's title attribute. * * @since 3.0.0 * * @param string $item_title The menu item title attribute. */ $menu_item->attr_title = empty($menu_item->attr_title) ? apply_filters('nav_menu_attr_title', $menu_item->post_excerpt) : $menu_item->attr_title; if (empty($menu_item->description)) { /** * Filter a navigation menu item's description. * * @since 3.0.0 * * @param string $description The menu item description. */ $menu_item->description = apply_filters('nav_menu_description', wp_trim_words($menu_item->post_content, 200)); } $menu_item->classes = empty($menu_item->classes) ? (array) get_post_meta($menu_item->ID, '_menu_item_classes', true) : $menu_item->classes; $menu_item->xfn = empty($menu_item->xfn) ? get_post_meta($menu_item->ID, '_menu_item_xfn', true) : $menu_item->xfn; } else { $menu_item->db_id = 0; $menu_item->menu_item_parent = 0; $menu_item->object_id = (int) $menu_item->ID; $menu_item->type = 'post_type'; $object = get_post_type_object($menu_item->post_type); $menu_item->object = $object->name; $menu_item->type_label = $object->labels->singular_name; if ('' === $menu_item->post_title) { $menu_item->post_title = sprintf(__('#%d (no title)'), $menu_item->ID); } $menu_item->title = $menu_item->post_title; $menu_item->url = get_permalink($menu_item->ID); $menu_item->target = ''; /** This filter is documented in wp-includes/nav-menu.php */ $menu_item->attr_title = apply_filters('nav_menu_attr_title', ''); /** This filter is documented in wp-includes/nav-menu.php */ $menu_item->description = apply_filters('nav_menu_description', ''); $menu_item->classes = array(); $menu_item->xfn = ''; } } elseif (isset($menu_item->taxonomy)) { $menu_item->ID = $menu_item->term_id; $menu_item->db_id = 0; $menu_item->menu_item_parent = 0; $menu_item->object_id = (int) $menu_item->term_id; $menu_item->post_parent = (int) $menu_item->parent; $menu_item->type = 'taxonomy'; $object = get_taxonomy($menu_item->taxonomy); $menu_item->object = $object->name; $menu_item->type_label = $object->labels->singular_name; $menu_item->title = $menu_item->name; $menu_item->url = get_term_link($menu_item, $menu_item->taxonomy); $menu_item->target = ''; $menu_item->attr_title = ''; $menu_item->description = get_term_field('description', $menu_item->term_id, $menu_item->taxonomy); $menu_item->classes = array(); $menu_item->xfn = ''; } /** * Filter a navigation menu item object. * * @since 3.0.0 * * @param object $menu_item The menu item object. */ return apply_filters('wp_setup_nav_menu_item', $menu_item); }
function _rs_mnt_modify_nav_menu_item($menu_item_id, $menu_operation) { if ($menu_item = get_post($menu_item_id)) { if ('nav_menu_item' == $menu_item->post_type) { //$item_type = get_post_meta( $menu_item_id, '_menu_item_type', true ); $object_type = get_post_meta($menu_item_id, '_menu_item_object', true); $object_id = get_post_meta($menu_item_id, '_menu_item_object_id', true); if (!($is_post_type = post_type_exists($object_type))) { $is_taxonomy = taxonomy_exists($object_type); } // WP performs update on every item even if no values have changed if ('edit' == $menu_operation) { $posted_vals = array(); foreach (array('title' => 'menu-item-title', 'attribute' => 'menu-item-attr-title', 'description' => 'menu-item-description', 'target' => 'menu-item-target', 'classes' => 'menu-item-classes', 'xfn' => 'menu-item-xfn', 'menu_order' => 'menu-item-position', 'menu_parent' => 'menu-item-parent-id') as $property => $col) { if (isset($_POST[$col][$menu_item_id])) { $posted_vals[$property] = $_POST[$col][$menu_item_id]; } } if (isset($posted_vals['classes'])) { $posted_vals['classes'] = array_map('sanitize_html_class', explode(' ', $posted_vals['classes'])); } $stored_vals = array(); foreach (array('title' => 'post_title', 'attribute' => 'post_excerpt', 'description' => 'post_content', 'menu_order' => 'menu_order') as $property => $col) { $stored_vals[$property] = $menu_item->{$col}; } $stored_vals['menu_parent'] = get_post_meta($menu_item_id, '_menu_item_menu_item_parent', true); $stored_vals['target'] = get_post_meta($menu_item_id, '_menu_item_target', true); $stored_vals['classes'] = (array) get_post_meta($menu_item_id, '_menu_item_classes', true); $stored_vals['xfn'] = get_post_meta($menu_item_id, '_menu_item_xfn', true); if (empty($stored_val['title'])) { $stored_vals['title'] = $is_post_type ? get_post_field('post_title', $object_id) : get_term_field('name', $object_id, $object_type); } $changed = false; foreach (array_keys($posted_vals) as $property) { if ($posted_vals[$property] != $stored_vals[$property]) { $changed = true; break; } } if (!$changed) { return; } } if ($is_post_type) { $deny_menu_operation = !current_user_can('edit_post', $object_id); } elseif ($is_taxonomy) { if ($tx_obj = get_taxonomy($object_type)) { $deny_menu_operation = !current_user_can($tx_obj->cap->manage_terms, $object_id); } } if (!empty($deny_menu_operation)) { if (empty($stored_vals['title'])) { $stored_vals['title'] = $menu_item->post_title; } if (!$stored_val['title']) { $stored_vals['title'] = $is_post_type ? get_post_field('post_title', $object_id) : get_term_field('name', $object_id, $object_type); } $link = admin_url('nav-menus.php'); switch ($menu_operation) { case 'move': wp_die(sprintf(__('You do not have permission to move the menu item "%1$s". <br /><br /><a href="%2$s">Return to Menu Editor</a>', 'scoper'), $stored_vals['title'], $link)); break; case 'delete': wp_die(sprintf(__('You do not have permission to delete the menu item "%1$s". <br /><br /><a href="%2$s">Return to Menu Editor</a>', 'scoper'), $stored_vals['title'], $link)); break; default: wp_die(sprintf(__('You do not have permission to edit the menu item "%1$s". <br /><br /><a href="%2$s">Return to Menu Editor</a>', 'scoper'), $stored_vals['title'], $link)); } // end switch } } } }