<div class="wrap-taxs-fields tab hide taxs_tab_div" id="taxs_tab"> <h5 class=" title font-quicksand"><?php _e("List Ad's taxonomies", ET_DOMAIN); ?> </h5> <div id="taxonomy_lists"> <ul class="pay-plans-list tax-list sortable add-fields ui-sortable"> <?php $taxs = (array) CE_Fields::get_taxs(); $list_tax = array(0 => ''); if (is_array($taxs) && !empty($taxs)) { foreach ($taxs as $key => $tax) { $status = isset($tax['tax_status']) && $tax['tax_status'] == 1 ? 1 : 0; ?> <li data="<?php echo $key; ?> " id="tax_key_<?php echo $key; ?> " class="item <?php if (!$status) { echo 'off'; } ?> "> <div class="sort-handle"></div> <span class="tax_label"><?php echo stripcslashes($tax['tax_label']); ?> </span>
public function check_taxonomy_exitst($tax_name, $tax_slug) { $taxs = CE_Fields::get_taxs(); if (is_array($taxs) && !empty($taxs)) { foreach ($taxs as $key => $tax) { if ($tax['tax_name'] == $tax_name || $tax['tax_slug'] == $tax_slug) { return true; } } } return false; }
function form($instance) { $taxs = CE_Fields::get_taxs(); $fname = isset($tax[0]['tax_name']) ? $tax[0]['tax_name'] : ''; $instance = wp_parse_args((array) $instance, array('tax_select' => $fname, 'title' => '', 'show_count' => false)); $title = esc_attr($instance['title']); ?> <p><label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:'); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?> " name="<?php echo $this->get_field_name('title'); ?> " type="text" value="<?php echo $title; ?> " /></p> <p> <label for="<?php echo $this->get_field_id('tax_select'); ?> "><?php _e('Select taxonomy:'); ?> </label> <select name="<?php echo $this->get_field_name('tax_select'); ?> " id="<?php echo $this->get_field_id('tax_select'); ?> " class="widefat"> <?php foreach ($taxs as $key => $tax) { ?> <option value="<?php echo $tax['tax_name']; ?> " <?php f_selected($instance['tax_select'], $tax['tax_name']); ?> > <?php echo $tax['tax_label']; ?> </option> <?php } ?> </select> </p> <p> <input type="checkbox" <?php if ($instance['show_count']) { echo 'checked="checked"'; } ?> id= "<?php echo $this->get_field_id('show_count'); ?> " name="<?php echo $this->get_field_name('show_count'); ?> " id="<?php echo $this->get_field_id('tax_select'); ?> " class="widefat" /> <label for="<?php echo $this->get_field_id('show_count'); ?> "><?php _e('Show post count:'); ?> </label> </p> <?php }
public function show_backend_taxonomy() { $fields = CE_Fields::get_taxs(); echo '<div id="ce_fields_controls">'; echo '<class="desc">'; echo '<div class="title">'; _e("Manager list taxonomies ad by CE custom fields extension.", ET_DOMAIN); echo '</div><br />'; $taxonomies = array(); foreach ($fields as $key => $field) { if (!$field['tax_status']) { continue; } $taxonomies[] = $field['tax_name']; $tax = new CE_Field_Tax($field); ?> <div class="title font-quicksand"> <div title="" class="title-main" style="text-transform:uppercase;"> <?php echo $field['tax_label']; ?> </div> </div> <div class="desc"> <?php printf(__("Manager taxonomy %s.", ET_DOMAIN), $field['tax_name']); ?> <div class="types-list-container" id="tax-<?php echo $field['tax_name']; ?> "> <!-- <ul class="list-job-input list-tax jobtype-sortable tax-sortable"> --> <?php $tax->print_backend_terms(); $tax->print_confirm_list($field); ?> </div> </div> <?php } echo '</div>'; wp_enqueue_script('ce-fields-settings', CE_FIELDS_URL . '/js/ce-fields-settings.js', array('jquery', 'jquery-ui-sortable', 'underscore', 'backbone', 'ce'), CE_FIELD_VER); wp_localize_script('ce-fields-settings', 'ce_fields', array('taxonomies' => $taxonomies)); }
/** * Start the element output. * * @see Walker::start_el() * * @since 2.1.0 * * @param string $output Passed by reference. Used to append additional content. * @param object $category Category data object. * @param int $depth Depth of category in reference to parents. Default 0. * @param array $args An array of arguments. @see wp_list_categories() * @param int $id ID of the current category. */ function start_el(&$output, $category, $depth = 0, $args = array(), $id = 0) { extract($args); global $wp_query; $taxs = CE_Fields::get_taxs(); $href = esc_url(get_term_link($category)); $field = $taxs[$category->taxonomy]; /** * process url to filter */ $cat_name = $category->name; $tax_slug = $field['tax_slug']; $ad_cat = isset($_REQUEST[$tax_slug]) ? $_REQUEST[$tax_slug] : ''; if (!is_home() && !is_single() && !is_tax($args['taxonomy'])) { $href = add_query_arg(array($field['tax_slug'] => $category->slug)); } if (!empty($ad_cat) && $ad_cat == $category->slug) { $href = remove_query_arg($field['tax_slug'], $href); } $link = '<a class="customize_text" href="' . $href . '" '; if ($use_desc_for_title == 0 || empty($category->description)) { $link .= 'title="' . esc_attr(sprintf(__('View all posts filed under %s'), $cat_name)) . '"'; } else { $link .= 'title="' . esc_attr(strip_tags(apply_filters('category_description', $category->description, $category))) . '"'; } $link .= '>'; $link .= $cat_name . '</a>'; if (!empty($feed_image) || !empty($feed)) { $link .= ' '; if (empty($feed_image)) { $link .= '('; } $link .= '<a href="' . esc_url(get_term_feed_link($category->term_id, $category->taxonomy, $feed_type)) . '"'; if (empty($feed)) { $alt = ' alt="' . sprintf(__('Feed for all posts filed under %s'), $cat_name) . '"'; } else { $title = ' title="' . $feed . '"'; $alt = ' alt="' . $feed . '"'; $name = $feed; $link .= $title; } $link .= '>'; if (empty($feed_image)) { $link .= $name; } else { $link .= "<img src='{$feed_image}'{$alt}{$title}" . ' />'; } $link .= '</a>'; if (empty($feed_image)) { $link .= ')'; } } if (!empty($show_count)) { $link .= '<span class="cat-count"> (' . intval($category->count) . ')</span>'; } /** * check cat is root and has children add icon next */ if ($category->has_child) { if ($args['hierarchical']) { $link = '<div class="border-bottom" >' . $link . '<i class="fa fa-arrow-right"></i></div>'; } else { $link = '<div class="border-bottom" >' . $link . '</div>'; } } else { if ($category->parent == 0) { $link = '<div class="border-bottom" >' . $link . '</div>'; } } if ('list' == $args['style']) { $output .= "\t<li"; $class = 'cat-item cat-item-' . $category->term_id; if ($category->slug == $ad_cat) { $class .= ' clicked active'; } if (!empty($current_category)) { $_current_category = get_term($current_category, $category->taxonomy); if ($category->term_id == $current_category) { $class .= ' clicked active'; } elseif ($category->term_id == $_current_category->parent) { $class .= ' clicked active'; } } // echo $class; $output .= ' class="' . $class . '"'; $output .= ">{$link}\n"; } else { $output .= "\t{$link}<br />\n"; } }