function extra_tablenav($which) { global $cat_id; if ('top' != $which) { return; } ?> <div class="alignleft actions"> <?php $dropdown_options = array('selected' => $cat_id, 'name' => 'cat_id', 'taxonomy' => 'link_category', 'show_option_all' => __('View all categories'), 'hide_empty' => true, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name'); nxt_dropdown_categories($dropdown_options); submit_button(__('Filter'), 'secondary', false, false, array('id' => 'post-query-submit')); ?> </div> <?php }
_e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?> </p> </div> <?php } // global_terms_enabled() if (is_taxonomy_hierarchical($taxonomy)) { ?> <div class="form-field"> <label for="parent"><?php _ex('Parent', 'Taxonomy Parent'); ?> </label> <?php nxt_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'taxonomy' => $taxonomy, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => true, 'show_option_none' => __('None'))); ?> <?php if ('category' == $taxonomy) { // @todo: Generic text for hierarchical taxonomies ?> <p><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?> </p> <?php } ?> </div> <?php }
_e('This will contain all of your posts, pages, comments, custom fields, terms, navigation menus and custom posts.'); ?> </span></p> <p><label><input type="radio" name="content" value="posts" /> <?php _e('Posts'); ?> </label></p> <ul id="post-filters" class="export-filters"> <li> <label><?php _e('Categories:'); ?> </label> <?php nxt_dropdown_categories(array('show_option_all' => __('All'))); ?> </li> <li> <label><?php _e('Authors:'); ?> </label> <?php $authors = $nxtdb->get_col("SELECT DISTINCT post_author FROM {$nxtdb->posts} WHERE post_type = 'post'"); nxt_dropdown_users(array('include' => $authors, 'name' => 'post_author', 'multi' => true, 'show_option_all' => __('All'))); ?> </li> <li> <label><?php _e('Date range:');
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? __('Categories') : $instance['title'], $instance, $this->id_base); $c = !empty($instance['count']) ? '1' : '0'; $h = !empty($instance['hierarchical']) ? '1' : '0'; $d = !empty($instance['dropdown']) ? '1' : '0'; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $cat_args = array('orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h); if ($d) { $cat_args['show_option_none'] = __('Select Category'); nxt_dropdown_categories(apply_filters('widget_categories_dropdown_args', $cat_args)); ?> <script type='text/javascript'> /* <![CDATA[ */ var dropdown = document.getElementById("cat"); function onCatChange() { if ( dropdown.options[dropdown.selectedIndex].value > 0 ) { location.href = "<?php echo home_url(); ?> /?cat="+dropdown.options[dropdown.selectedIndex].value; } } dropdown.onchange = onCatChange; /* ]]> */ </script> <?php } else { ?> <ul> <?php $cat_args['title_li'] = ''; nxt_list_categories(apply_filters('widget_categories_args', $cat_args)); ?> </ul> <?php } echo $after_widget; }
function _nxt_ajax_add_hierarchical_term() { $action = $_POST['action']; $taxonomy = get_taxonomy(substr($action, 4)); check_ajax_referer($action, '_ajax_nonce-add-' . $taxonomy->name); if (!current_user_can($taxonomy->cap->edit_terms)) { die('-1'); } $names = explode(',', $_POST['new' . $taxonomy->name]); $parent = isset($_POST['new' . $taxonomy->name . '_parent']) ? (int) $_POST['new' . $taxonomy->name . '_parent'] : 0; if (0 > $parent) { $parent = 0; } if ($taxonomy->name == 'category') { $post_category = isset($_POST['post_category']) ? (array) $_POST['post_category'] : array(); } else { $post_category = isset($_POST['tax_input']) && isset($_POST['tax_input'][$taxonomy->name]) ? (array) $_POST['tax_input'][$taxonomy->name] : array(); } $checked_categories = array_map('absint', (array) $post_category); $popular_ids = nxt_popular_terms_checklist($taxonomy->name, 0, 10, false); foreach ($names as $cat_name) { $cat_name = trim($cat_name); $category_nicename = sanitize_title($cat_name); if ('' === $category_nicename) { continue; } if (!($cat_id = term_exists($cat_name, $taxonomy->name, $parent))) { $new_term = nxt_insert_term($cat_name, $taxonomy->name, array('parent' => $parent)); $cat_id = $new_term['term_id']; } $checked_categories[] = $cat_id; if ($parent) { // Do these all at once in a second continue; } $category = get_term($cat_id, $taxonomy->name); ob_start(); nxt_terms_checklist(0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $cat_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids)); $data = ob_get_contents(); ob_end_clean(); $add = array('what' => $taxonomy->name, 'id' => $cat_id, 'data' => str_replace(array("\n", "\t"), '', $data), 'position' => -1); } if ($parent) { // Foncy - replace the parent and all its children $parent = get_term($parent, $taxonomy->name); $term_id = $parent->term_id; while ($parent->parent) { // get the top parent $parent =& get_term($parent->parent, $taxonomy->name); if (is_nxt_error($parent)) { break; } $term_id = $parent->term_id; } ob_start(); nxt_terms_checklist(0, array('taxonomy' => $taxonomy->name, 'descendants_and_self' => $term_id, 'selected_cats' => $checked_categories, 'popular_cats' => $popular_ids)); $data = ob_get_contents(); ob_end_clean(); $add = array('what' => $taxonomy->name, 'id' => $term_id, 'data' => str_replace(array("\n", "\t"), '', $data), 'position' => -1); } ob_start(); nxt_dropdown_categories(array('taxonomy' => $taxonomy->name, 'hide_empty' => 0, 'name' => 'new' . $taxonomy->name . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $taxonomy->labels->parent_item . ' —')); $sup = ob_get_contents(); ob_end_clean(); $add['supplemental'] = array('newcat_parent' => $sup); $x = new nxt_Ajax_Response($add); $x->send(); }
</label></th> <td> <input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option('mailserver_pass'); ?> " class="regular-text" /> </td> </tr> <tr valign="top"> <th scope="row"><label for="default_email_category"><?php _e('Default Mail Category'); ?> </label></th> <td> <?php nxt_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_category', 'orderby' => 'name', 'selected' => get_option('default_email_category'), 'hierarchical' => true)); ?> </td> </tr> <?php do_settings_fields('writing', 'post_via_email'); ?> </table> <?php } ?> <h3><?php _e('Remote Publishing'); ?> </h3>
_e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?> </p></td> </tr> <?php } if (is_taxonomy_hierarchical($taxonomy)) { ?> <tr class="form-field"> <th scope="row" valign="top"><label for="parent"><?php _ex('Parent', 'Taxonomy Parent'); ?> </label></th> <td> <?php nxt_dropdown_categories(array('hide_empty' => 0, 'hide_if_empty' => false, 'name' => 'parent', 'orderby' => 'name', 'taxonomy' => $taxonomy, 'selected' => $tag->parent, 'exclude_tree' => $tag->term_id, 'hierarchical' => true, 'show_option_none' => __('None'))); ?> <br /> <?php if ('category' == $taxonomy) { ?> <span class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?> </span> <?php } ?> </td> </tr> <?php
function extra_tablenav($which) { global $post_type_object, $cat; ?> <div class="alignleft actions"> <?php if ('top' == $which && !is_singular()) { $this->months_dropdown($post_type_object->name); if (is_object_in_taxonomy($post_type_object->name, 'category')) { $dropdown_options = array('show_option_all' => __('View all categories'), 'hide_empty' => 0, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name', 'selected' => $cat); nxt_dropdown_categories($dropdown_options); } do_action('restrict_manage_posts'); submit_button(__('Filter'), 'secondary', false, false, array('id' => 'post-query-submit')); } if ($this->is_trash && current_user_can($post_type_object->cap->edit_others_posts)) { submit_button(__('Empty Trash'), 'button-secondary apply', 'delete_all', false); } ?> </div> <?php }
/** * @since 0.71 * @deprecated 2.1 * @deprecated Use nxt_dropdown_categories() * @see nxt_dropdown_categories() * * @param int $optionall * @param string $all * @param string $orderby * @param string $order * @param int $show_last_update * @param int $show_count * @param int $hide_empty * @param bool $optionnone * @param int $selected * @param int $exclude * @return unknown */ function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc', $show_last_update = 0, $show_count = 0, $hide_empty = 1, $optionnone = false, $selected = 0, $exclude = 0) { _deprecated_function(__FUNCTION__, '2.1', 'nxt_dropdown_categories()'); $show_option_all = ''; if ($optionall) { $show_option_all = $all; } $show_option_none = ''; if ($optionnone) { $show_option_none = __('None'); } $vars = compact('show_option_all', 'show_option_none', 'orderby', 'order', 'show_last_update', 'show_count', 'hide_empty', 'selected', 'exclude'); $query = add_query_arg($vars, ''); return nxt_dropdown_categories($query); }
/** * Render a category select tag */ public function render_field() { $args = array('show_option_all' => null, 'show_option_none' => null, 'orderby' => 'ID', 'order' => 'ASC', 'show_last_update' => false, 'show_count' => false, 'hide_empty' => false, 'child_of' => false, 'exclude' => null, 'echo' => true, 'selected' => $this->get(), 'hierarchical' => false, 'name' => $this->name, 'id' => $this->field_id, 'class' => $this->field_class, 'depth' => false, 'tab_index' => false, 'taxonomy' => 'category', 'hide_if_empty' => false); // use NXTClass function nxt_dropdown_categories($args); }
/** * Display post categories form fields. * * @since 2.6.0 * * @param object $post */ function post_categories_meta_box($post, $box) { $defaults = array('taxonomy' => 'category'); if (!isset($box['args']) || !is_array($box['args'])) { $args = array(); } else { $args = $box['args']; } extract(nxt_parse_args($args, $defaults), EXTR_SKIP); $tax = get_taxonomy($taxonomy); ?> <div id="taxonomy-<?php echo $taxonomy; ?> " class="categorydiv"> <ul id="<?php echo $taxonomy; ?> -tabs" class="category-tabs"> <li class="tabs"><a href="#<?php echo $taxonomy; ?> -all" tabindex="3"><?php echo $tax->labels->all_items; ?> </a></li> <li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?> -pop" tabindex="3"><?php _e('Most Used'); ?> </a></li> </ul> <div id="<?php echo $taxonomy; ?> -pop" class="tabs-panel" style="display: none;"> <ul id="<?php echo $taxonomy; ?> checklist-pop" class="categorychecklist form-no-clear" > <?php $popular_ids = nxt_popular_terms_checklist($taxonomy); ?> </ul> </div> <div id="<?php echo $taxonomy; ?> -all" class="tabs-panel"> <?php $name = $taxonomy == 'category' ? 'post_category' : 'tax_input[' . $taxonomy . ']'; echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks. ?> <ul id="<?php echo $taxonomy; ?> checklist" class="list:<?php echo $taxonomy; ?> categorychecklist form-no-clear"> <?php nxt_terms_checklist($post->ID, array('taxonomy' => $taxonomy, 'popular_cats' => $popular_ids)); ?> </ul> </div> <?php if (current_user_can($tax->cap->edit_terms)) { ?> <div id="<?php echo $taxonomy; ?> -adder" class="nxt-hidden-children"> <h4> <a id="<?php echo $taxonomy; ?> -add-toggle" href="#<?php echo $taxonomy; ?> -add" class="hide-if-no-js" tabindex="3"> <?php /* translators: %s: add new taxonomy label */ printf(__('+ %s'), $tax->labels->add_new_item); ?> </a> </h4> <p id="<?php echo $taxonomy; ?> -add" class="category-add nxt-hidden-child"> <label class="screen-reader-text" for="new<?php echo $taxonomy; ?> "><?php echo $tax->labels->add_new_item; ?> </label> <input type="text" name="new<?php echo $taxonomy; ?> " id="new<?php echo $taxonomy; ?> " class="form-required form-input-tip" value="<?php echo esc_attr($tax->labels->new_item_name); ?> " tabindex="3" aria-required="true"/> <label class="screen-reader-text" for="new<?php echo $taxonomy; ?> _parent"> <?php echo $tax->labels->parent_item_colon; ?> </label> <?php nxt_dropdown_categories(array('taxonomy' => $taxonomy, 'hide_empty' => 0, 'name' => 'new' . $taxonomy . '_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => '— ' . $tax->labels->parent_item . ' —', 'tab_index' => 3)); ?> <input type="button" id="<?php echo $taxonomy; ?> -add-submit" class="add:<?php echo $taxonomy; ?> checklist:<?php echo $taxonomy; ?> -add button category-add-sumbit" value="<?php echo esc_attr($tax->labels->add_new_item); ?> " tabindex="3" /> <?php nxt_nonce_field('add-' . $taxonomy, '_ajax_nonce-add-' . $taxonomy, false); ?> <span id="<?php echo $taxonomy; ?> -ajax-response"></span> </p> </div> <?php } ?> </div> <?php }
$arcresults = $nxtdb->get_results($query); foreach ((array) $arcresults as $arcresult) { if (isset($_POST['et-month-choice']) && $_POST['et-month-choice'] == $arcresult->year . $arcresult->month) { $selected = ' selected="selected"'; } echo "<option value='{$arcresult->year}{$arcresult->month}'{$selected}>{$nxt_locale->get_month($arcresult->month)}" . ", {$arcresult->year}</option>"; if ($selected != '') { $selected = ''; } } ?> </select> </p> <p id="et_choose_cat"><?php nxt_dropdown_categories('show_option_all=Choose a Category&show_count=1&hierarchical=1&id=et-cat&name=et-cat'); ?> </p> </div> <!-- #et-search-left --> <div id="et-search-right"> <input type="hidden" name="et_searchform_submit" value="et_search_proccess" /> <input class="et_search_submit" type="submit" value="<?php esc_attr_e('Submit', 'Modest'); ?> " id="et_search_submit" /> </div> <!-- #et-search-right --> </form> </div> <!-- end #et-search-inner --> </div> <!-- end #et-search -->