本文整理汇总了PHP中sp_dropdown_taxonomies函数的典型用法代码示例。如果您正苦于以下问题:PHP sp_dropdown_taxonomies函数的具体用法?PHP sp_dropdown_taxonomies怎么用?PHP sp_dropdown_taxonomies使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sp_dropdown_taxonomies函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
/**
* Output the metabox
*/
public static function output($post)
{
$taxonomies = get_object_taxonomies('sp_event');
$minutes = get_post_meta($post->ID, 'sp_minutes', true);
?>
<?php
do_action('sportspress_event_details_meta_box', $post);
?>
<div class="sp-event-minutes-field">
<p><strong><?php
_e('Full Time', 'sportspress');
?>
</strong></p>
<p>
<input name="sp_minutes" type="number" step="1" min="0" class="small-text" placeholder="<?php
echo get_option('sportspress_event_minutes', 90);
?>
" value="<?php
echo esc_attr($minutes);
?>
">
<?php
_e('mins', 'sportspress');
?>
</p>
</div>
<?php
foreach ($taxonomies as $taxonomy) {
if ('sp_venue' == $taxonomy) {
continue;
}
sp_taxonomy_field($taxonomy, $post, true, true);
}
?>
<div class="sp-event-sp_venue-field">
<p><strong><?php
_e('Venue', 'sportspress');
?>
</strong></p>
<p>
<?php
$terms = get_the_terms($post->ID, 'sp_venue');
$args = array('taxonomy' => 'sp_venue', 'name' => 'tax_input[sp_venue][]', 'class' => 'sp-has-dummy', 'selected' => sp_get_the_term_id_or_meta($post->ID, 'sp_venue'), 'values' => 'term_id', 'show_option_none' => __('— Not set —', 'sportspress'), 'chosen' => true);
if (in_array('sp_venue', apply_filters('sportspress_event_auto_taxonomies', array('sp_venue')))) {
$args['show_option_all'] = __('(Auto)', 'sportspress');
}
if (!sp_dropdown_taxonomies($args)) {
sp_taxonomy_adder('sp_venue', 'sp_event', __('Add New', 'sportspress'));
}
?>
</p>
</div>
<?php
}
示例2: output
/**
* Output the metabox
*/
public static function output($post)
{
$minutes = get_post_meta($post->ID, 'sp_minutes', true);
$taxonomies = apply_filters('prosports_event_taxonomies', array('sp_league' => null, 'sp_season' => null, 'sp_venue' => 'sp_event'));
?>
<div class="sp-event-minutes-field">
<p><strong><?php
_e('Full Time', 'prosports');
?>
</strong></p>
<p>
<input name="sp_minutes" type="number" step="1" min="0" class="small-text" placeholder="<?php
echo get_option('prosports_event_minutes', 90);
?>
" value="<?php
echo $minutes;
?>
">
<?php
_e('mins', 'prosports');
?>
</p>
</div>
<?php
foreach ($taxonomies as $taxonomy => $post_type) {
$obj = get_taxonomy($taxonomy);
if ($obj) {
?>
<div class="sp-event-<?php
echo $taxonomy;
?>
-field">
<p><strong><?php
echo $obj->labels->singular_name;
?>
</strong></p>
<p>
<?php
$args = array('taxonomy' => $taxonomy, 'name' => $taxonomy, 'class' => 'sp-has-dummy', 'selected' => sp_get_the_term_id_or_meta($post->ID, $taxonomy), 'values' => 'term_id', 'show_option_none' => __('-- Not set --', 'prosports'));
if (in_array($taxonomy, apply_filters('prosports_event_auto_taxonomies', array('sp_venue')))) {
$args['show_option_all'] = __('(Auto)', 'prosports');
}
if (!sp_dropdown_taxonomies($args)) {
sp_taxonomy_adder($taxonomy, $post_type, $obj->labels->add_new_item);
}
?>
</p>
</div>
<?php
}
}
}
示例3: filters
/**
* Show a category filter box
*/
public function filters()
{
global $typenow, $wp_query;
if ($typenow != 'sp_table') {
return;
}
$selected = isset($_REQUEST['sp_league']) ? $_REQUEST['sp_league'] : null;
$args = array('show_option_all' => __('Show all competitions', 'sportspress'), 'taxonomy' => 'sp_league', 'name' => 'sp_league', 'selected' => $selected);
sp_dropdown_taxonomies($args);
$selected = isset($_REQUEST['sp_season']) ? $_REQUEST['sp_season'] : null;
$args = array('show_option_all' => __('Show all seasons', 'sportspress'), 'taxonomy' => 'sp_season', 'name' => 'sp_season', 'selected' => $selected);
sp_dropdown_taxonomies($args);
$selected = isset($_REQUEST['team']) ? $_REQUEST['team'] : null;
$args = array('post_type' => 'sp_team', 'name' => 'team', 'show_option_none' => __('Show all teams', 'sportspress'), 'selected' => $selected, 'values' => 'ID');
wp_dropdown_pages($args);
}
示例4: output
/**
* Output the metabox
*/
public static function output($post)
{
$limit = get_option('prosports_event_teams', 2);
$teams = (array) get_post_meta($post->ID, 'sp_team', false);
$league_id = sp_get_the_term_id($post->ID, 'sp_league', 0);
$season_id = sp_get_the_term_id($post->ID, 'sp_season', 0);
for ($i = 0; $i < $limit; $i++) {
$team = array_shift($teams);
?>
<div class="sp-instance">
<p class="sp-tab-select sp-tab-select-dummy">
<?php
$args = array('taxonomy' => 'sp_league', 'name' => 'sp_league_dummy', 'class' => 'sp-dummy sp_league-dummy', 'show_option_all' => __('All', 'prosports'), 'selected' => $league_id, 'values' => 'term_id');
sp_dropdown_taxonomies($args);
?>
</p>
<p class="sp-tab-select sp-tab-select-dummy">
<?php
$args = array('taxonomy' => 'sp_season', 'name' => 'sp_season_dummy', 'class' => 'sp-dummy sp_season-dummy', 'show_option_all' => __('All', 'prosports'), 'selected' => $season_id, 'values' => 'term_id');
sp_dropdown_taxonomies($args);
?>
</p>
<p class="sp-tab-select sp-title-generator">
<?php
$args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'class' => 'prosports-pages', 'show_option_none' => __('— None —', 'prosports'), 'show_option_all' => __('— Individual —', 'prosports'), 'values' => 'ID', 'selected' => $team);
sp_dropdown_pages($args);
?>
</p>
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
<li class="wp-tab-active"><a href="#sp_player-all"><?php
_e('Players', 'prosports');
?>
</a></li>
<li class="wp-tab"><a href="#sp_staff-all"><?php
_e('Staff', 'prosports');
?>
</a></li>
</ul>
<?php
sp_post_checklist($post->ID, 'sp_player', 'block', array('sp_league', 'sp_season', 'sp_current_team'), $i);
sp_post_checklist($post->ID, 'sp_staff', 'none', array('sp_league', 'sp_season', 'sp_current_team'), $i);
?>
</div>
<?php
}
}
示例5: output
/**
* Output the metabox
*/
public static function output($post)
{
wp_nonce_field('prosports_save_data', 'prosports_meta_nonce');
$league_id = sp_get_the_term_id($post->ID, 'sp_league', 0);
$season_id = sp_get_the_term_id($post->ID, 'sp_season', 0);
?>
<div>
<p><strong><?php
_e('Competition', 'prosports');
?>
</strong></p>
<p class="sp-tab-select">
<?php
$args = array('taxonomy' => 'sp_league', 'name' => 'sp_league', 'show_option_all' => __('All', 'prosports'), 'selected' => $league_id, 'values' => 'term_id');
if (!sp_dropdown_taxonomies($args)) {
sp_taxonomy_adder('sp_league', 'sp_team', __('Add New', 'prosports'));
}
?>
</p>
<p><strong><?php
_e('Season', 'prosports');
?>
</strong></p>
<p class="sp-tab-select">
<?php
$args = array('taxonomy' => 'sp_season', 'name' => 'sp_season', 'show_option_all' => __('All', 'prosports'), 'selected' => $season_id, 'values' => 'term_id');
if (!sp_dropdown_taxonomies($args)) {
sp_taxonomy_adder('sp_season', 'sp_team', __('Add New', 'prosports'));
}
?>
</p>
<p><strong><?php
_e('Teams', 'prosports');
?>
</strong></p>
<?php
sp_post_checklist($post->ID, 'sp_team', 'block', array('sp_league', 'sp_season'));
sp_post_adder('sp_team', __('Add New', 'prosports'));
?>
</div>
<?php
}
示例6: options
/**
* options function.
*
* @access public
* @return void
*/
function options()
{
?>
<table class="form-table">
<tbody>
<tr>
<th scope="row"><label><?php
_e('Format', 'sportspress');
?>
</label><br/></th>
<td class="forminp forminp-radio" id="sp_formatdiv">
<fieldset id="post-formats-select">
<ul>
<li><input type="radio" name="sp_format" class="post-format" id="post-format-league" value="league" checked="checked"> <label for="post-format-league" class="post-format-icon post-format-league"><?php
_e('Competitive', 'sportspress');
?>
</label></li>
<li><input type="radio" name="sp_format" class="post-format" id="post-format-friendly" value="friendly"> <label for="post-format-friendly" class="post-format-icon post-format-friendly"><?php
_e('Friendly', 'sportspress');
?>
</label></li>
<br>
</fieldset>
</td>
</tr>
<tr>
<th scope="row"><label><?php
_e('Competition', 'sportspress');
?>
</label><br/></th>
<td><?php
$args = array('taxonomy' => 'sp_league', 'name' => 'sp_league', 'values' => 'slug', 'show_option_none' => __('— Not set —', 'sportspress'));
if (!sp_dropdown_taxonomies($args)) {
echo '<p>' . __('None', 'sportspress') . '</p>';
sp_taxonomy_adder('sp_league', 'sp_team', __('Add New', 'sportspress'));
}
?>
</td>
</tr>
<tr>
<th scope="row"><label><?php
_e('Season', 'sportspress');
?>
</label><br/></th>
<td><?php
$args = array('taxonomy' => 'sp_season', 'name' => 'sp_season', 'values' => 'slug', 'show_option_none' => __('— Not set —', 'sportspress'));
if (!sp_dropdown_taxonomies($args)) {
echo '<p>' . __('None', 'sportspress') . '</p>';
sp_taxonomy_adder('sp_season', 'sp_team', __('Add New', 'sportspress'));
}
?>
</td>
</tr>
<tr>
<th scope="row" class="titledesc">
<?php
_e('Date Format', 'sportspress');
?>
</th>
<td class="forminp forminp-radio">
<fieldset>
<ul>
<li>
<label><input name="sp_date_format" value="yyyy/mm/dd" type="radio" checked> yyyy/mm/dd</label>
</li>
<li>
<label><input name="sp_date_format" value="dd/mm/yyyy" type="radio"> dd/mm/yyyy</label>
</li>
<li>
<label><input name="sp_date_format" value="mm/dd/yyyy" type="radio"> mm/dd/yyyy</label>
</li>
</ul>
</fieldset>
</td>
</tr>
</tbody>
</table>
<?php
}
示例7: table
//.........这里部分代码省略.........
_e('Cancel', 'sportspress');
?>
</a>
<a class="button button-primary sp-save"><?php
_e('Save', 'sportspress');
?>
</a>
</span>
</td>
<?php
if (array_key_exists('team', $columns) && apply_filters('sportspress_has_teams', true)) {
?>
<td>
<?php
$selected = sp_array_value($player_stats, 'team', get_post_meta(get_the_ID(), 'sp_team', true));
if (!$selected) {
$selected = get_post_meta($player_id, 'sp_team', true);
}
$include = get_post_meta($player_id, 'sp_team');
$args = array('post_type' => 'sp_team', 'name' => 'sp_players[' . $player_id . '][team]', 'include' => $include, 'selected' => $selected, 'values' => 'ID');
wp_dropdown_pages($args);
?>
</td>
<?php
}
?>
<?php
if (array_key_exists('position', $columns)) {
?>
<td>
<?php
$selected = sp_array_value($player_stats, 'position', null);
$args = array('taxonomy' => 'sp_position', 'name' => 'sp_players[' . $player_id . '][position]', 'show_option_blank' => __('(Auto)', 'sportspress'), 'values' => 'term_id', 'orderby' => 'slug', 'selected' => $selected, 'include_children' => 'no' == get_option('sportspress_event_hide_child_positions', 'no'));
sp_dropdown_taxonomies($args);
?>
</td>
<?php
}
?>
<?php
foreach ($columns as $column => $label) {
if (in_array($column, array('number', 'team', 'position'))) {
continue;
}
$value = sp_array_value($player_stats, $column, '');
$placeholder = sp_array_value(sp_array_value($placeholders, $player_id, array()), $column, 0);
?>
<td><input type="text" name="sp_players[<?php
echo $player_id;
?>
][<?php
echo $column;
?>
]" value="<?php
echo esc_attr($value);
?>
" placeholder="<?php
echo esc_attr($placeholder);
?>
" data-placeholder="<?php
echo esc_attr($placeholder);
?>
" data-matrix="<?php
echo $player_id;
?>
_<?php
示例8: event_blocks_shortcode
/**
* AJAX event_blocks shortcode
*/
public function event_blocks_shortcode()
{
?>
<div class="wrap sp-thickbox-content" id="sp-thickbox-event_blocks">
<p>
<label>
<?php
_e('Title:', 'sportspress');
?>
<input class="regular-text" type="text" name="title">
</label>
</p>
<p>
<label>
<?php
printf(__('Select %s:', 'sportspress'), __('Calendar', 'sportspress'));
?>
<?php
$args = array('post_type' => 'sp_calendar', 'show_option_all' => __('All', 'sportspress'), 'name' => 'id', 'values' => 'ID');
sp_dropdown_pages($args);
?>
</label>
</p>
<p>
<label>
<?php
_e('Team:', 'sportspress');
?>
<?php
$args = array('post_type' => 'sp_team', 'show_option_all' => __('Default', 'sportspress'), 'name' => 'team', 'values' => 'ID');
sp_dropdown_pages($args);
?>
</label>
</p>
<p>
<label>
<?php
_e('Competition:', 'sportspress');
?>
<?php
$args = array('taxonomy' => 'sp_league', 'show_option_all' => __('Default', 'sportspress'), 'name' => 'league', 'values' => 'term_id');
sp_dropdown_taxonomies($args);
?>
</label>
</p>
<p>
<label>
<?php
_e('Season:', 'sportspress');
?>
<?php
$args = array('taxonomy' => 'sp_season', 'show_option_all' => __('Default', 'sportspress'), 'name' => 'season', 'values' => 'term_id');
sp_dropdown_taxonomies($args);
?>
</label>
</p>
<p>
<label>
<?php
_e('Venue:', 'sportspress');
?>
<?php
$args = array('taxonomy' => 'sp_venue', 'show_option_all' => __('Default', 'sportspress'), 'name' => 'venue', 'values' => 'term_id');
sp_dropdown_taxonomies($args);
?>
</label>
</p>
<p>
<label>
<?php
_e('Status:', 'sportspress');
?>
<?php
$args = array('name' => 'status', 'show_option_default' => __('Default', 'sportspress'));
sp_dropdown_statuses($args);
?>
</label>
</p>
<p>
<label>
<?php
_e('Date:', 'sportspress');
?>
<select id="date" name="date">
<option value="default"><?php
_e('Default', 'sportspress');
?>
</option>
<option value=""><?php
_e('All', 'sportspress');
?>
</option>
<option value="w"><?php
_e('This week', 'sportspress');
?>
</option>
<option value="day"><?php
//.........这里部分代码省略.........
示例9: filters
/**
* Show a category filter box
*/
public function filters()
{
global $typenow, $wp_query;
if ($typenow != 'sp_event') {
return;
}
$selected = isset($_REQUEST['team']) ? $_REQUEST['team'] : null;
$args = array('post_type' => 'sp_team', 'name' => 'team', 'show_option_none' => __('Show all teams', 'sportspress'), 'selected' => $selected, 'values' => 'ID');
wp_dropdown_pages($args);
$selected = isset($_REQUEST['sp_league']) ? $_REQUEST['sp_league'] : null;
$args = array('show_option_all' => __('Show all competitions', 'sportspress'), 'taxonomy' => 'sp_league', 'name' => 'sp_league', 'selected' => $selected);
sp_dropdown_taxonomies($args);
$selected = isset($_REQUEST['sp_season']) ? $_REQUEST['sp_season'] : null;
$args = array('show_option_all' => __('Show all seasons', 'sportspress'), 'taxonomy' => 'sp_season', 'name' => 'sp_season', 'selected' => $selected);
sp_dropdown_taxonomies($args);
if (current_user_can('edit_others_sp_events')) {
wp_nonce_field('sp-save-inline-results', 'sp-inline-nonce', false);
}
}
示例10: output
/**
* Output the metabox
*/
public static function output($post)
{
wp_nonce_field('sportspress_save_data', 'sportspress_meta_nonce');
$continents = SP()->countries->continents;
$number = get_post_meta($post->ID, 'sp_number', true);
$nationality = get_post_meta($post->ID, 'sp_nationality', true);
if (2 == strlen($nationality)) {
$legacy = SP()->countries->legacy;
$nationality = strtolower($nationality);
$nationality = sp_array_value($legacy, $nationality, null);
}
$leagues = get_the_terms($post->ID, 'sp_league');
$league_ids = array();
if ($leagues) {
foreach ($leagues as $league) {
$league_ids[] = $league->term_id;
}
}
$seasons = get_the_terms($post->ID, 'sp_season');
$season_ids = array();
if ($seasons) {
foreach ($seasons as $season) {
$season_ids[] = $season->term_id;
}
}
$positions = get_the_terms($post->ID, 'sp_position');
$position_ids = array();
if ($positions) {
foreach ($positions as $position) {
$position_ids[] = $position->term_id;
}
}
$teams = get_posts(array('post_type' => 'sp_team', 'posts_per_page' => -1));
$past_teams = array_filter(get_post_meta($post->ID, 'sp_past_team', false));
$current_teams = array_filter(get_post_meta($post->ID, 'sp_current_team', false));
?>
<p><strong><?php
_e('Squad Number', 'sportspress');
?>
</strong></p>
<p><input type="text" size="4" id="sp_number" name="sp_number" value="<?php
echo $number;
?>
"></p>
<p><strong><?php
_e('Nationality', 'sportspress');
?>
</strong></p>
<p><select id="sp_nationality" name="sp_nationality" data-placeholder="<?php
printf(__('Select %s', 'sportspress'), __('Nationality', 'sportspress'));
?>
" class="widefat chosen-select<?php
if (is_rtl()) {
?>
chosen-rtl<?php
}
?>
">
<option value=""></option>
<?php
foreach ($continents as $continent => $countries) {
?>
<optgroup label="<?php
echo $continent;
?>
">
<?php
foreach ($countries as $code => $country) {
?>
<option value="<?php
echo $code;
?>
" <?php
selected($nationality, $code);
?>
><?php
echo $country;
?>
</option>
<?php
}
?>
</optgroup>
<?php
}
?>
</select></p>
<p><strong><?php
_e('Positions', 'sportspress');
?>
</strong></p>
<p><?php
$args = array('taxonomy' => 'sp_position', 'name' => 'tax_input[sp_position][]', 'selected' => $position_ids, 'values' => 'term_id', 'placeholder' => sprintf(__('Select %s', 'sportspress'), __('Positions', 'sportspress')), 'class' => 'widefat', 'property' => 'multiple', 'chosen' => true);
sp_dropdown_taxonomies($args);
?>
//.........这里部分代码省略.........
示例11: filters
/**
* Show a category filter box
*/
public function filters()
{
global $typenow, $wp_query;
if ($typenow != 'sp_team') {
return;
}
$selected = isset($_REQUEST['sp_league']) ? $_REQUEST['sp_league'] : null;
$args = array('show_option_all' => __('Show all competitions', 'prosports'), 'taxonomy' => 'sp_league', 'name' => 'sp_league', 'selected' => $selected);
sp_dropdown_taxonomies($args);
$selected = isset($_REQUEST['sp_season']) ? $_REQUEST['sp_season'] : null;
$args = array('show_option_all' => __('Show all seasons', 'prosports'), 'taxonomy' => 'sp_season', 'name' => 'sp_season', 'selected' => $selected);
sp_dropdown_taxonomies($args);
}
示例12: sp_taxonomy_field
function sp_taxonomy_field($taxonomy = 'category', $post = null, $multiple = false, $trigger = false)
{
$obj = get_taxonomy($taxonomy);
if ($obj) {
$post_type = get_post_type($post);
?>
<div class="<?php
echo $post_type;
?>
-<?php
echo $taxonomy;
?>
-field">
<p><strong><?php
echo $obj->labels->singular_name;
?>
</strong></p>
<p>
<?php
$terms = get_the_terms($post->ID, $taxonomy);
$term_ids = array();
if ($terms) {
foreach ($terms as $term) {
$term_ids[] = $term->term_id;
}
}
$args = array('taxonomy' => $taxonomy, 'name' => 'tax_input[' . $taxonomy . '][]', 'selected' => $term_ids, 'values' => 'term_id', 'class' => 'sp-has-dummy widefat' . ($trigger ? ' sp-ajax-trigger' : ''), 'chosen' => true, 'placeholder' => __('All', 'sportspress'));
if ($multiple) {
$args['property'] = 'multiple';
}
if (!sp_dropdown_taxonomies($args)) {
sp_taxonomy_adder($taxonomy, $post_type, $obj->labels->add_new_item);
}
?>
</p>
</div>
<?php
}
}
示例13: output
/**
* Output the metabox
*/
public static function output($post)
{
$status = get_post_meta($post->ID, 'sp_status', true);
$date = get_post_meta($post->ID, 'sp_date', true);
$date_from = get_post_meta($post->ID, 'sp_date_from', true);
$date_to = get_post_meta($post->ID, 'sp_date_to', true);
$league_id = sp_get_the_term_id($post->ID, 'sp_league', 0);
$season_id = sp_get_the_term_id($post->ID, 'sp_season', 0);
$venue_id = sp_get_the_term_id($post->ID, 'sp_venue', 0);
$team_id = get_post_meta($post->ID, 'sp_team', true);
$order = get_post_meta($post->ID, 'sp_order', true);
?>
<div>
<p><strong><?php
_e('Status', 'prosports');
?>
</strong></p>
<p>
<?php
$args = array('name' => 'sp_status', 'id' => 'sp_status', 'selected' => $status);
sp_dropdown_statuses($args);
?>
</p>
<div class="sp-date-selector">
<p><strong><?php
_e('Date', 'prosports');
?>
</strong></p>
<p>
<?php
$args = array('name' => 'sp_date', 'id' => 'sp_date', 'selected' => $date);
sp_dropdown_dates($args);
?>
</p>
<p class="sp-date-range">
<input type="text" class="sp-datepicker-from" name="sp_date_from" value="<?php
echo $date_from ? $date_from : date_i18n('Y-m-d');
?>
" size="10">
:
<input type="text" class="sp-datepicker-to" name="sp_date_to" value="<?php
echo $date_to ? $date_to : date_i18n('Y-m-d');
?>
" size="10">
</p>
</div>
<p><strong><?php
_e('Competition', 'prosports');
?>
</strong></p>
<p>
<?php
$args = array('show_option_all' => __('All', 'prosports'), 'taxonomy' => 'sp_league', 'name' => 'sp_league', 'selected' => $league_id, 'values' => 'term_id');
if (!sp_dropdown_taxonomies($args)) {
sp_taxonomy_adder('sp_league', 'sp_team', __('Add New', 'prosports'));
}
?>
</p>
<p><strong><?php
_e('Season', 'prosports');
?>
</strong></p>
<p class="sp-tab-select">
<?php
$args = array('show_option_all' => __('All', 'prosports'), 'taxonomy' => 'sp_season', 'name' => 'sp_season', 'selected' => $season_id, 'values' => 'term_id');
if (!sp_dropdown_taxonomies($args)) {
sp_taxonomy_adder('sp_season', 'sp_team', __('Add New', 'prosports'));
}
?>
</p>
<p><strong><?php
_e('Venue', 'prosports');
?>
</strong></p>
<p>
<?php
$args = array('show_option_all' => __('All', 'prosports'), 'taxonomy' => 'sp_venue', 'name' => 'sp_venue', 'selected' => $venue_id, 'values' => 'term_id');
if (!sp_dropdown_taxonomies($args)) {
sp_taxonomy_adder('sp_season', 'sp_team', __('Add New', 'prosports'));
}
?>
</p>
<p><strong><?php
_e('Team', 'prosports');
?>
</strong></p>
<p>
<?php
$args = array('show_option_all' => __('All', 'prosports'), 'post_type' => 'sp_team', 'name' => 'sp_team', 'selected' => $team_id, 'values' => 'ID');
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_team', __('Add New', 'prosports'));
}
?>
</p>
<p><strong><?php
_e('Sort Order', 'prosports');
?>
//.........这里部分代码省略.........
示例14: table
//.........这里部分代码省略.........
<?php
foreach ($data as $player_id => $player_performance) {
if (!$player_id) {
continue;
}
$number = get_post_meta($player_id, 'sp_number', true);
$value = sp_array_value($player_performance, 'number', '');
?>
<tr class="sp-row sp-post" data-player="<?php
echo $player_id;
?>
">
<td class="icon"><span class="dashicons dashicons-menu post-state-format"></span></td>
<td>
<input class="small-text sp-player-number-input" type="text" name="sp_players[<?php
echo $team_id;
?>
][<?php
echo $player_id;
?>
][number]" value="<?php
echo $value;
?>
" />
</td>
<td><?php
echo get_the_title($player_id);
?>
</td>
<td>
<?php
$selected = sp_array_value($player_performance, 'position', null);
if ($selected == null) {
$selected = sp_get_the_term_id($player_id, 'sp_position', 0);
}
$args = array('taxonomy' => 'sp_position', 'name' => 'sp_players[' . $team_id . '][' . $player_id . '][position]', 'values' => 'term_id', 'orderby' => 'slug', 'selected' => $selected);
sp_dropdown_taxonomies($args);
?>
</td>
<?php
foreach ($labels as $column => $label) {
$value = sp_array_value($player_performance, $column, '');
?>
<td>
<input class="sp-player-<?php
echo $column;
?>
-input" type="text" name="sp_players[<?php
echo $team_id;
?>
][<?php
echo $player_id;
?>
][<?php
echo $column;
?>
]" value="<?php
echo $value;
?>
" placeholder="0" />
</td>
<?php
}
?>
<?php
if ($team_id) {
?>
<td class="sp-status-selector">
<?php
echo self::status_select($team_id, $player_id, sp_array_value($player_performance, 'status', null));
?>
<?php
echo self::sub_select($team_id, $player_id, sp_array_value($player_performance, 'sub', null), $data);
?>
</td>
<?php
} else {
?>
<td>
<?php
$values = sp_array_value($player_performance, 'outcome', '');
if (!is_array($values)) {
$values = array($values);
}
$args = array('post_type' => 'sp_outcome', 'name' => 'sp_players[' . $team_id . '][' . $player_id . '][outcome][]', 'option_none_value' => '', 'sort_order' => 'ASC', 'sort_column' => 'menu_order', 'selected' => $values, 'class' => 'sp-outcome', 'property' => 'multiple', 'chosen' => true, 'placeholder' => __('None', 'prosports'));
sp_dropdown_pages($args);
?>
</td>
<?php
}
?>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<?php
}
示例15: output
/**
* Output the metabox
*/
public static function output($post)
{
$league_id = sp_get_the_term_id($post->ID, 'sp_league', 0);
$season_id = sp_get_the_term_id($post->ID, 'sp_season', 0);
$team_id = get_post_meta($post->ID, 'sp_team', true);
$grouping = get_post_meta($post->ID, 'sp_grouping', true);
$orderby = get_post_meta($post->ID, 'sp_orderby', true);
$order = get_post_meta($post->ID, 'sp_order', true);
?>
<div>
<p><strong><?php
_e('Competition', 'prosports');
?>
</strong></p>
<p class="sp-tab-select">
<?php
$args = array('taxonomy' => 'sp_league', 'name' => 'sp_league', 'show_option_all' => __('All', 'prosports'), 'selected' => $league_id, 'values' => 'term_id');
if (!sp_dropdown_taxonomies($args)) {
sp_taxonomy_adder('sp_league', 'sp_team', __('Add New', 'prosports'));
}
?>
</p>
<p><strong><?php
_e('Season', 'prosports');
?>
</strong></p>
<p class="sp-tab-select">
<?php
$args = array('taxonomy' => 'sp_season', 'name' => 'sp_season', 'show_option_all' => __('All', 'prosports'), 'selected' => $season_id, 'values' => 'term_id');
if (!sp_dropdown_taxonomies($args)) {
sp_taxonomy_adder('sp_season', 'sp_team', __('Add New', 'prosports'));
}
?>
</p>
<p><strong><?php
_e('Team', 'prosports');
?>
</strong></p>
<p class="sp-tab-select">
<?php
$args = array('post_type' => 'sp_team', 'name' => 'sp_team', 'show_option_all' => __('All', 'prosports'), 'selected' => $team_id, 'values' => 'ID');
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_team', __('Add New', 'prosports'));
}
?>
</p>
<p><strong><?php
_e('Grouping', 'prosports');
?>
</strong></p>
<p>
<select name="sp_grouping">
<option value="0"><?php
_e('None', 'prosports');
?>
</option>
<option value="position" <?php
selected($grouping, 'position');
?>
><?php
_e('Position', 'prosports');
?>
</option>
</select>
</p>
<p><strong><?php
_e('Sort by', 'prosports');
?>
</strong></p>
<p>
<?php
$args = array('prepend_options' => array('number' => __('Number', 'prosports'), 'name' => __('Name', 'prosports')), 'post_type' => array('sp_performance', 'sp_metric', 'sp_statistic'), 'name' => 'sp_orderby', 'selected' => $orderby, 'values' => 'slug');
sp_dropdown_pages($args);
?>
</p>
<p><strong><?php
_e('Sort Order', 'prosports');
?>
</strong></p>
<p>
<select name="sp_order">
<option value="ASC" <?php
selected('ASC', $order);
?>
><?php
_e('Ascending', 'prosports');
?>
</option>
<option value="DESC" <?php
selected('DESC', $order);
?>
><?php
_e('Descending', 'prosports');
?>
</option>
</select>
</p>
//.........这里部分代码省略.........