本文整理汇总了PHP中wp_dropdown_categories函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_dropdown_categories函数的具体用法?PHP wp_dropdown_categories怎么用?PHP wp_dropdown_categories使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_dropdown_categories函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_content
public function render_content()
{
$dropdown = wp_dropdown_categories(array('name' => '_customize-dropdown-categories-' . $this->id, 'echo' => 0, 'show_option_all' => __('— All Categories —', 'scoutwp-theme'), 'selected' => $this->value()));
// Add in the link
$dropdown = str_replace('<select', '<select ' . $this->get_link(), $dropdown);
echo "<label class='customize-control-select'><span class='customize-control-title'>{$this->label}</span><span class='description customize-control-description'>{$this->description}</span> {$dropdown}</label>";
}
示例2: extra_tablenav
function extra_tablenav($which)
{
global $post_type_object, $cat;
$term_id = 0;
?>
<div class="alignleft actions"> <?php
if ('top' == $which && !is_singular()) {
$this->months_dropdown(self::$post_type);
if (is_object_in_taxonomy(self::$post_type, SI_Record::TAXONOMY)) {
$term_id = isset($_GET[SI_Record::TAXONOMY]) ? $_GET[SI_Record::TAXONOMY] : 0;
$dropdown_options = array('taxonomy' => SI_Record::TAXONOMY, 'show_option_all' => __('View all types'), 'hide_empty' => 0, 'hierarchical' => 1, 'show_count' => 0, 'orderby' => 'name', 'selected' => $term_id, 'name' => SI_Record::TAXONOMY);
wp_dropdown_categories($dropdown_options);
}
do_action('restrict_manage_posts');
submit_button(__('Filter'), 'secondary', false, false, array('id' => 'post-query-submit'));
// Purge
if (count($this->items) > 0) {
if (isset($_GET[SI_Record::TAXONOMY]) && $_GET[SI_Record::TAXONOMY]) {
$term = get_term($_GET[SI_Record::TAXONOMY], SI_Record::TAXONOMY);
$button_label = __('Purge') . ' ' . $term->name . ' ' . __('Type');
}
$button_label = isset($button_label) ? $button_label : __('Purge All Types');
printf('<button type="submit" name="purge_records" class="button" value="%s">%s</button>', $term_id, $button_label);
printf('<input type="hidden" name="%s" value="%s" />', SI_Internal_Records::RECORD_PURGE_NONCE, wp_create_nonce(SI_Internal_Records::RECORD_PURGE_NONCE));
}
}
?>
</div> <?php
}
示例3: jbst_taxonomy_select
function jbst_taxonomy_select($field, $meta)
{
wp_dropdown_categories(array('show_option_none' => 'Default', 'hierarchical' => 1, 'taxonomy' => $field['taxonomy'], 'orderby' => 'name', 'hide_empty' => 0, 'name' => $field['id'], 'selected' => $meta));
if (!empty($field['desc'])) {
echo '<p class="cmb_metabox_description">' . $field['desc'] . '</p>';
}
}
示例4: widget
/**
* Outputs the HTML for this widget.
*
* @param array $args An array of standard parameters for widgets in this theme
* @param array $instance An array of settings for this widget instance
*
* @return void Echoes it's output
*/
public function widget($args, $instance)
{
$instance = wp_parse_args($instance, $this->defaults);
extract($args);
if ($title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base)) {
echo $before_title . esc_html($title) . $after_title;
}
echo $before_widget;
?>
<form method="get" action="<?php
echo esc_url(home_url('/'));
?>
" class="<?php
echo $instance['instance'] ? 'instance-search' : '';
?>
">
<div class="product-cat">
<?php
wp_dropdown_categories(array('name' => 'product_cat', 'taxonomy' => 'product_cat', 'class' => 'cs-select cs-skin-elastic', 'orderby' => 'NAME', 'order' => 'ASC', 'hierarchical' => 1, 'hide_empty' => 0, 'show_option_all' => __('All Categories', 'bigboom'), 'walker' => new TA_Cat_Slug_Walker()));
?>
</div>
<input type="text" name="s" class="search-field" placeholder="Search the entire shop.....">
<input type="hidden" name="post_type" value="product">
<input type="submit" value="<?php
esc_attr_e('Search', 'bigboom');
?>
" class="search-submit">
</form>
<?php
echo $after_widget;
}
示例5: html
public function html($meta, $repeatable = null)
{
is_array($meta) and $meta = null;
$name = is_null($repeatable) ? $this->_name : $this->_name . '[' . $repeatable . ']';
$id = is_null($repeatable) ? $this->_id : $this->_id . '_' . $repeatable;
$classes = array();
if (!empty($this->_params['context']) and $this->_params['context'] != 'side') {
$classes[] = 'form-field';
}
$classes = implode(' ', $classes);
empty($classes) or $classes = ' class="' . $classes . '"';
$args = array('id' => $id, 'name' => $name, 'selected' => $meta, 'echo' => 0, 'class' => $classes);
empty($this->_params['args']) or $args = array_merge($args, $this->_params['args']);
echo '<tr' . $classes . '>';
echo '
<th scope="row">
<label for="' . $id . '">' . $this->_label . '</label>
</th>
<td>
' . wp_dropdown_categories($args) . '
<p class="description">' . $this->_description . '</p>
</td>';
echo '</tr>';
}
示例6: formCreate
function formCreate($instance,$headline_instance, $cat_instance, $dropdown_instance,$num_post_instance){
//Generates widget options form which you see in the widgets section in the admin
$headline = esc_attr($instance[$headline_instance]);
$include_cats = esc_attr($instance[$cat_instance]);
$num_post_selected = esc_attr($instance[$num_post_instance]);
?>
<p><label for="<? echo $this->get_field_id($headline_instance); ?>">Headline:
<input class="widefat"
id="<? echo $this->get_field_id($headline_instance); ?>"
name="<? echo $this->get_field_name($headline_instance); ?>"
type="text"
value="<? echo attribute_escape($headline); ?>" />
</label>
</p>
<p>
Categories Dropdown / How Many Posts<br />
<? wp_dropdown_categories('orderby=name&hide_empty=0&show_option_none=Select Categories to include&id='.$dropdown_instance.'&name='.$dropdown_instance.'&taxonomy=category'); echo " "; echo $this->dw_createNumSelect($this->get_field_id($num_post_instance),$this->get_field_name($num_post_instance),10,$num_post_selected);?> <br /><br />
<label for="<? echo $this->get_field_id($cat_instance); ?>">Included Categories:
<textarea class="widefat"
id="<? echo $this->get_field_id($cat_instance); ?>"
name="<? echo $this->get_field_name($cat_instance); ?>"
rows="2"
cols="1" style="text-align:left;"><? echo attribute_escape($include_cats); ?></textarea>
</label>
</p>
<?
}
示例7: show_ajax_form
public function show_ajax_form()
{
if (isset($_REQUEST['productid'])) {
$dropdownargs = array('show_option_all' => false, 'show_option_none' => false, 'orderby' => 'id', 'order' => 'ASC', 'show_count' => 1, 'hide_empty' => 0, 'child_of' => 0, 'exclude' => '', 'echo' => 0, 'selected' => 0, 'hierarchical' => 1, 'name' => 'wcordersortupdateshelf', 'id' => '', 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => 'product_shelf', 'hide_if_empty' => false, 'option_none_value' => -1, 'value_field' => 'term_id');
$echo = '';
$product_name = '<a href="' . get_post_permalink($_REQUEST['productid']) . '" >' . get_the_title($_REQUEST['productid']) . '</a>';
$echo .= '<form method="post"> <table class="flat-table" cellspacing="3" >';
$echo .= '<tr>';
$echo .= '<th>Product Name : </th>';
$echo .= '<td>' . $product_name . '</td>';
$echo .= '</tr>';
$echo .= '<tr>';
$echo .= '<th>Shelf : </th>';
$echo .= '<td>' . wp_dropdown_categories($dropdownargs) . '</td>';
$echo .= '</tr>';
$echo .= '<tr>';
$echo .= '<td><input type="hidden" name="action" value="wcordersortforechangeshelf" /> </td>';
$echo .= '<td><input type="submit" class="myButton "value="Update Shelf"/> </td>';
$echo .= '</tr>';
$echo .= '</table> </form>';
$echo .= '<style>';
$echo .= 'table { width: 100%; }
th { background: #eee; color: black; font-weight: bold; }
td, th { padding: 6px; border: 1px solid #ccc; text-align: left; }';
$echo .= ".myButton {\tbackground:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #77b55a), color-stop(1, #72b352)); background:-moz-linear-gradient(top, #77b55a 5%, #72b352 100%); \tbackground:-webkit-linear-gradient(top, #77b55a 5%, #72b352 100%); \tbackground:-o-linear-gradient(top, #77b55a 5%, #72b352 100%); background:-ms-linear-gradient(top, #77b55a 5%, #72b352 100%); background:linear-gradient(to bottom, #77b55a 5%, #72b352 100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77b55a', endColorstr='#72b352',GradientType=0); background-color:#77b55a; -moz-border-radius:4px; \t-webkit-border-radius:4px; \tborder-radius:4px; \tborder:1px solid #4b8f29; display:inline-block; cursor:pointer; color:#ffffff; font-family:Arial; font-size:15px; font-weight:bold; padding:6px 12px;\ttext-decoration:none;\ttext-shadow:0px 1px 0px #5b8a3c;} .myButton:hover { background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #72b352), color-stop(1, #77b55a)); \tbackground:-moz-linear-gradient(top, #72b352 5%, #77b55a 100%); \tbackground:-webkit-linear-gradient(top, #72b352 5%, #77b55a 100%); \tbackground:-o-linear-gradient(top, #72b352 5%, #77b55a 100%); \tbackground:-ms-linear-gradient(top, #72b352 5%, #77b55a 100%); \tbackground:linear-gradient(to bottom, #72b352 5%, #77b55a 100%); filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#72b352', endColorstr='#77b55a',GradientType=0); \tbackground-color:#72b352; } .myButton:active { \tposition:relative; \ttop:1px; }";
$echo .= '</style>';
echo $echo;
}
wp_die();
}
示例8: render_content
public function render_content()
{
$dropdown = wp_dropdown_categories(array('name' => $this->id, 'echo' => 0, 'show_option_all' => __('All', 'matheson'), 'selected' => $this->value(), 'class' => 'customize-dropdown-cats'));
// hackily add in the data link parameter.
$dropdown = str_replace('<select', '<select ' . $this->get_link(), $dropdown);
printf('<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>', $this->label, $dropdown);
}
示例9: job_manager_job_filters_search_jobs_end
/**
* Add the field to the filters
*/
public function job_manager_job_filters_search_jobs_end($atts)
{
if ((!isset($atts['selected_region']) || '' == $atts['selected_region']) && isset($_GET['search_region'])) {
$atts['selected_region'] = absint($_GET['search_region']);
}
wp_dropdown_categories(apply_filters('job_manager_regions_dropdown_args', array('show_option_all' => __('All Regions', 'wp-job-manager-locations'), 'hierarchical' => true, 'taxonomy' => 'job_listing_region', 'name' => 'search_region', 'class' => 'search_region', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 0, 'selected' => isset($atts['selected_region']) ? $atts['selected_region'] : '')));
}
示例10: build_taxo_dd_filter
function build_taxo_dd_filter()
{
$tax_name = $this->name;
$tax_obj = get_taxonomy($tax_name);
$selected = empty($_GET[$tax_name]) ? '' : $_GET[$tax_name];
wp_dropdown_categories(array('show_option_all' => __('Show All ' . $tax_obj->label . ' '), 'taxonomy' => $tax_name, 'name' => $tax_obj->name, 'orderby' => 'name', 'selected' => $selected, 'hierarchical' => $tax_obj->hierarchical, 'show_count' => false, 'hide_empty' => false));
}
示例11: render_content
/**
* Render the control's content.
*
* @since 3.4.0
*/
public function render_content()
{
$dropdown = wp_dropdown_categories(array('name' => '_customize-dropdown-categories-' . $this->id, 'echo' => 0, 'show_option_none' => __('— Select —'), 'option_none_value' => '0', 'selected' => $this->value()));
// Hackily add in the data link parameter.
$dropdown = str_replace('<select', '<select ' . $this->get_link(), $dropdown);
printf('<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>', $this->label, $dropdown);
}
示例12: sbc_shortcode
function sbc_shortcode($atts)
{
extract(shortcode_atts(array(' ' => null), $atts));
$args = array('show_option_none' => 'Select category', 'show_count' => 1, 'orderby' => 'name', 'echo' => 1, 'child_of' => tb_get_option('main_course_select'), 'class' => 'form-control subject');
?>
<section class="course-finder">
<h6 class="section-heading text-highlight"><span class="line">Course Finder</span></h1>
<div class="section-content">
<form class="course-finder-form" action="<?php
echo esc_url(home_url('/'));
?>
" method="get">
<div class="row">
<div class="col-md-5 col-sm-5 subject">
<?php
wp_dropdown_categories($args);
?>
</div>
<div class="col-md-7 col-sm-7 keywords">
<input type="text" class="form-control pull-left" name="s" id="s" placeholder="Search keywords" />
<button type="submit" class="btn btn-theme">
<i class="fa fa-search"></i>
</button>
</div>
</div>
<input type="hidden" name="post_type" value="courses" />
</form><!--//course-finder-form-->
<a class="read-more" href="<?php
echo esc_url(get_permalink(get_page_by_title('Courses')));
?>
">View all our courses<i class="fa fa-chevron-right"></i></a>
</div><!--//section-content-->
</section><!--//course-finder-->
<?php
}
示例13: restrict_contacts_by_status
public static function restrict_contacts_by_status()
{
global $typenow;
if (Sprout_Client::POST_TYPE === $typenow) {
$selected = 0;
$taxonomy = Sprout_Client::TYPE_TAXONOMY;
if (isset($_GET[$taxonomy]) && $_GET[$taxonomy]) {
$term = get_term_by('slug', $_GET[$taxonomy], $taxonomy);
$selected = $term->term_id;
}
$status_taxonomy = get_taxonomy($taxonomy);
wp_dropdown_categories(array('show_option_all' => sprintf(self::__('All %s'), $status_taxonomy->label), 'taxonomy' => $taxonomy, 'name' => $taxonomy, 'orderby' => 'name', 'selected' => $selected, 'show_count' => true, 'value_field' => 'slug'));
$type_selected = 0;
$taxonomy = Sprout_Client::STATUS_TAXONOMY;
if (isset($_GET[$taxonomy]) && $_GET[$taxonomy]) {
$term = get_term_by('slug', $_GET[$taxonomy], $taxonomy);
$type_selected = $term->term_id;
}
$status_taxonomy = get_taxonomy($taxonomy);
wp_dropdown_categories(array('show_option_all' => sprintf(self::__('All %s'), $status_taxonomy->label), 'taxonomy' => $taxonomy, 'name' => $taxonomy, 'orderby' => 'name', 'selected' => $type_selected, 'show_count' => true, 'value_field' => 'slug'));
if ($selected || $type_selected) {
$url = add_query_arg(array('post_type' => Sprout_Client::POST_TYPE), admin_url('edit.php'));
printf('<a href="%s" id="filter_reset_link" class="del_button">X</a>', $url);
}
}
}
示例14: render_content
public function render_content()
{
$dropdown = wp_dropdown_categories(array('name' => $this->name, 'echo' => 0, 'hide_empty' => false, 'show_option_none' => false, 'hide_if_empty' => false, 'selected' => $this->value()));
$dropdown = str_replace('<select', '<select multiple = "multiple" style = "height:95px;" ' . $this->get_link(), $dropdown);
printf('<label class="customize-control-select"><span class="customize-control-title">%s</span> %s</label>', $this->label, $dropdown);
echo '<p class="description">' . __('Hold down the Ctrl (windows) / Command (Mac) button to select multiple options.', 'catch-base') . '</p>';
}
示例15: render_content
/**
* Render the control to be displayed in the Customizer.
*/
public function render_content()
{
$default_args = array('show_option_none' => ' ', 'option_none_value' => '0', 'taxonomy' => 'category');
$args = wp_parse_args($this->args, $default_args);
$args['name'] = '_customize-dropdown-taxonomies-' . $this->id;
$args['selected'] = $this->value();
$args['echo'] = false;
?>
<label>
<?php
if (!empty($this->label)) {
?>
<span class="customize-control-title"><?php
echo esc_html($this->label);
?>
</span>
<?php
}
if (!empty($this->description)) {
?>
<span class="description customize-control-description"><?php
echo $this->description;
?>
</span>
<?php
}
?>
<?php
echo str_replace('<select', '<select ' . $this->get_link(), wp_dropdown_categories($args));
?>
</label>
<?php
}