本文整理汇总了PHP中sp_dropdown_pages函数的典型用法代码示例。如果您正苦于以下问题:PHP sp_dropdown_pages函数的具体用法?PHP sp_dropdown_pages怎么用?PHP sp_dropdown_pages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sp_dropdown_pages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
}
}
示例2: form
function form($instance)
{
$instance = wp_parse_args((array) $instance, array('title' => '', 'id' => ''));
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
// Action to hook into
do_action('sportspress_before_widget_template_form', $this, $instance, 'staff');
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title:', 'sportspress');
?>
</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 esc_attr($title);
?>
" /></p>
<p><label for="<?php
echo $this->get_field_id('id');
?>
"><?php
printf(__('Select %s:', 'sportspress'), __('Staff', 'sportspress'));
?>
</label>
<?php
$args = array('post_type' => 'sp_staff', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'widefat');
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_staff', __('Add New', 'sportspress'));
}
?>
</p>
<?php
// Action to hook into
do_action('sportspress_after_widget_template_form', $this, $instance, 'staff');
}
示例3: details
/**
* Output the details metabox
*/
public static function details($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);
$rounds = get_post_meta($post->ID, 'sp_rounds', true);
if ($rounds === '') {
$rounds = 3;
}
$winner = get_post_meta($post->ID, 'sp_winner', true);
?>
<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('Rounds', 'prosports');
?>
</strong></p>
<p><input name="sp_rounds" type="number" min="1" max="6" value="<?php
echo $rounds;
?>
" placeholder="0" class="small-text sp-autosave"></p>
<p><strong><?php
_e('Winner', 'prosports');
?>
</strong></p>
<p>
<?php
$args = array('show_option_none' => __('-- Not set --', 'prosports'), 'post_type' => 'sp_team', 'name' => 'sp_winner', 'selected' => $winner, 'values' => 'ID');
sp_dropdown_pages($args);
?>
</p>
</div>
<?php
}
示例4: table
//.........这里部分代码省略.........
">
<input type="checkbox" name="sp_result_columns[]" value="<?php
echo $key;
?>
" id="sp_result_columns_<?php
echo $key;
?>
" <?php
checked(!is_array($usecolumns) || in_array($key, $usecolumns));
?>
>
<?php
echo $label;
?>
</label>
<?php
} else {
?>
<?php
echo $label;
?>
<?php
}
?>
</th>
<?php
}
?>
<th class="column-outcome">
<?php
_e('Outcome', 'sportspress');
?>
</th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($data as $team_id => $team_results) {
if (!$team_id || -1 == $team_id) {
continue;
}
?>
<tr class="sp-row sp-post<?php
if ($i % 2 == 0) {
echo ' alternate';
}
?>
">
<td>
<?php
echo get_the_title($team_id);
?>
</td>
<?php
foreach ($columns as $column => $label) {
$value = sp_array_value($team_results, $column, '');
?>
<td><input type="text" name="sp_results[<?php
echo $team_id;
?>
][<?php
echo $column;
?>
]" value="<?php
echo esc_attr($value);
?>
"<?php
if (in_array($column, $auto_columns)) {
?>
placeholder="<?php
_e('(Auto)', 'sportspress');
?>
"<?php
}
?>
/></td>
<?php
}
?>
<td>
<?php
$values = sp_array_value($team_results, 'outcome', '');
if (!is_array($values)) {
$values = array($values);
}
$args = array('post_type' => 'sp_outcome', 'name' => 'sp_results[' . $team_id . '][outcome][]', 'option_none_value' => '', 'sort_order' => 'ASC', 'sort_column' => 'menu_order', 'selected' => $values, 'class' => 'sp-outcome', 'property' => 'multiple', 'chosen' => true, 'placeholder' => __('(Auto)', 'sportspress'));
sp_dropdown_pages($args);
?>
</td>
</tr>
<?php
$i++;
}
?>
</tbody>
</table>
</div>
<?php
}
示例5: form
function form($instance)
{
$instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => 5, 'show_all_staff_link' => true));
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$number = intval($instance['number']);
$show_all_staff_link = $instance['show_all_staff_link'];
// Action to hook into
do_action('sportspress_before_widget_template_form', $this, $instance, 'staff-list');
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title:', 'sportspress');
?>
</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 esc_attr($title);
?>
" /></p>
<p><label for="<?php
echo $this->get_field_id('id');
?>
"><?php
printf(__('Select %s:', 'sportspress'), __('Staff Directory', 'sportspress'));
?>
</label>
<?php
$args = array('post_type' => 'sp_directory', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'widefat');
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_directory', __('Add New', 'sportspress'));
}
?>
</p>
<p><label for="<?php
echo $this->get_field_id('number');
?>
"><?php
_e('Number of staff to show:', 'sportspress');
?>
</label>
<input id="<?php
echo $this->get_field_id('number');
?>
" name="<?php
echo $this->get_field_name('number');
?>
" type="text" value="<?php
echo esc_attr($number);
?>
" size="3"></p>
<p><input class="checkbox" type="checkbox" id="<?php
echo $this->get_field_id('show_all_staff_link');
?>
" name="<?php
echo $this->get_field_name('show_all_staff_link');
?>
" value="1" <?php
checked($show_all_staff_link, 1);
?>
>
<label for="<?php
echo $this->get_field_id('show_all_staff_link');
?>
"><?php
_e('Display link to view all staff', 'sportspress');
?>
</label></p>
<?php
// Action to hook into
do_action('sportspress_after_widget_template_form', $this, $instance, 'staff-list');
}
示例6: 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');
?>
//.........这里部分代码省略.........
示例7: table
//.........这里部分代码省略.........
$value = sp_array_value($leagues, $div_id, '-1');
?>
<input type="hidden" name="sp_leagues[<?php
echo $league_id;
?>
][<?php
echo $div_id;
?>
]" value="-1">
<input type="checkbox" name="sp_leagues[<?php
echo $league_id;
?>
][<?php
echo $div_id;
?>
]" value="1" <?php
checked($value);
?>
>
<?php
}
?>
<?php
if ('WP_Error' == get_class($div)) {
_e('Total', 'sportspress');
} else {
echo $div->name;
}
?>
</label>
<?php
} else {
?>
<?php
if ('WP_Error' == get_class($div)) {
_e('Total', 'sportspress');
} else {
echo $div->name;
}
?>
<?php
}
?>
</td>
<?php
if (apply_filters('sportspress_player_team_statistics', $league_id)) {
?>
<?php
if ($div_id == 0) {
?>
<td> </td>
<?php
} else {
?>
<td>
<?php
$value = sp_array_value($leagues, $div_id, '-1');
?>
<?php
$args = array('post_type' => 'sp_team', 'name' => 'sp_leagues[' . $league_id . '][' . $div_id . ']', 'show_option_none' => __('— None —', 'sportspress'), 'sort_order' => 'ASC', 'sort_column' => 'menu_order', 'selected' => $value, 'values' => 'ID', 'include' => $teams, 'tax_query' => array('relation' => 'AND', array('taxonomy' => 'sp_league', 'terms' => $league_id, 'field' => 'id'), array('taxonomy' => 'sp_season', 'terms' => $div_id, 'field' => 'id')));
if (!sp_dropdown_pages($args)) {
_e('— None —', 'sportspress');
}
?>
</td>
<?php
}
?>
<?php
}
?>
<?php
foreach ($columns as $column => $label) {
if ($column == 'team') {
continue;
}
?>
<td><?php
$value = sp_array_value(sp_array_value($data, $div_id, array()), $column, null);
$placeholder = sp_array_value(sp_array_value($placeholders, $div_id, array()), $column, 0);
if ($readonly) {
echo $value ? $value : $placeholder;
} else {
echo '<input type="text" name="sp_statistics[' . $league_id . '][' . $div_id . '][' . $column . ']" value="' . $value . '" placeholder="' . $placeholder . '"' . ($readonly ? ' disabled="disabled"' : '') . ' />';
}
?>
</td>
<?php
}
?>
</tr>
<?php
$i++;
}
?>
</tbody>
</table>
</div>
<?php
}
示例8: form
function form($instance)
{
$instance = wp_parse_args((array) $instance, array('title' => '', 'id' => '', 'number' => 5, 'columns' => null, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true));
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$number = intval($instance['number']);
$columns = $instance['columns'];
$orderby = strip_tags($instance['orderby']);
$order = strip_tags($instance['order']);
$show_all_players_link = $instance['show_all_players_link'];
// Action to hook into
do_action('prosports_before_widget_template_form', $this, $instance, 'player-list');
?>
<p><label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title:', 'prosports');
?>
</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 esc_attr($title);
?>
" /></p>
<p><label for="<?php
echo $this->get_field_id('id');
?>
"><?php
printf(__('Select %s:', 'prosports'), __('Player List', 'prosports'));
?>
</label>
<?php
$args = array('post_type' => 'sp_list', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'widefat');
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_list', __('Add New', 'prosports'));
}
?>
</p>
<p><label for="<?php
echo $this->get_field_id('number');
?>
"><?php
_e('Number of players to show:', 'prosports');
?>
</label>
<input id="<?php
echo $this->get_field_id('number');
?>
" name="<?php
echo $this->get_field_name('number');
?>
" type="text" value="<?php
echo esc_attr($number);
?>
" size="3"></p>
<p class="sp-prefs">
<?php
_e('Performance:', 'prosports');
?>
<br>
<?php
$args = array('post_type' => array('sp_metric', 'sp_performance', 'sp_statistic'), 'numberposts' => -1, 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC');
$the_columns = get_posts($args);
$field_name = $this->get_field_name('columns') . '[]';
$field_id = $this->get_field_id('columns');
?>
<?php
foreach ($the_columns as $column) {
?>
<label class="button"><input name="<?php
echo $field_name;
?>
" type="checkbox" id="<?php
echo $field_id . '-' . $column->post_name;
?>
" value="<?php
echo $column->post_name;
?>
" <?php
if ($columns === null || in_array($column->post_name, $columns)) {
?>
checked="checked"<?php
}
?>
><?php
echo $column->post_title;
?>
</label>
<?php
}
?>
//.........这里部分代码省略.........
示例9: 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>
//.........这里部分代码省略.........
示例10: output
/**
* Output the metabox
*/
public static function output($post)
{
$taxonomies = get_object_taxonomies('sp_calendar');
$caption = get_post_meta($post->ID, 'sp_caption', true);
$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);
$day = get_post_meta($post->ID, 'sp_day', true);
$teams = get_post_meta($post->ID, 'sp_team', false);
$table_id = get_post_meta($post->ID, 'sp_table', true);
$orderby = get_post_meta($post->ID, 'sp_orderby', true);
$order = get_post_meta($post->ID, 'sp_order', true);
?>
<div>
<p><strong><?php
_e('Heading', 'sportspress');
?>
</strong></p>
<p><input type="text" id="sp_caption" name="sp_caption" value="<?php
echo esc_attr($caption);
?>
" placeholder="<?php
echo esc_attr(get_the_title());
?>
"></p>
<p><strong><?php
_e('Status', 'sportspress');
?>
</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', 'sportspress');
?>
</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>
<div class="sp-event-day-field">
<p><strong><?php
_e('Match Day', 'sportspress');
?>
</strong></p>
<p>
<input name="sp_day" type="text" class="medium-text" placeholder="<?php
_e('All', 'sportspress');
?>
" value="<?php
echo esc_attr($day);
?>
">
</p>
</div>
<?php
foreach ($taxonomies as $taxonomy) {
sp_taxonomy_field($taxonomy, $post, true);
}
?>
<p><strong><?php
_e('Team', 'sportspress');
?>
</strong></p>
<p>
<?php
$args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'selected' => $teams, 'values' => 'ID', 'class' => 'widefat', 'property' => 'multiple', 'chosen' => true, 'placeholder' => __('All', 'sportspress'));
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_team', __('Add New', 'sportspress'));
}
?>
</p>
<p><strong><?php
_e('Sort by', 'sportspress');
?>
</strong></p>
<p>
//.........这里部分代码省略.........
示例11: output
/**
* Output the metabox
*/
public static function output($post)
{
$limit = get_option('sportspress_event_teams', 2);
$teams = (array) get_post_meta($post->ID, 'sp_team', false);
if ($limit) {
for ($i = 0; $i < $limit; $i++) {
$team = array_shift($teams);
?>
<div class="sp-instance">
<p class="sp-tab-select sp-title-generator">
<?php
$args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'class' => 'sportspress-pages', 'show_option_none' => __('— None —', 'sportspress'), 'values' => 'ID', 'selected' => $team, 'chosen' => true, 'tax_query' => array());
if ('yes' == get_option('sportspress_event_filter_teams_by_league', 'no')) {
$league_id = sp_get_the_term_id($post->ID, 'sp_league', 0);
if ($league_id) {
$args['tax_query'][] = array('taxonomy' => 'sp_league', 'terms' => $league_id);
}
}
if ('yes' == get_option('sportspress_event_filter_teams_by_season', 'no')) {
$season_id = sp_get_the_term_id($post->ID, 'sp_season', 0);
if ($season_id) {
$args['tax_query'][] = array('taxonomy' => 'sp_season', 'terms' => $season_id);
}
}
if (!sp_dropdown_pages($args)) {
unset($args['tax_query']);
sp_dropdown_pages($args);
}
?>
</p>
<?php
$tabs = array();
$sections = get_option('sportspress_event_performance_sections', -1);
if (0 == $sections) {
$tabs['sp_offense'] = array('label' => __('Offense', 'sportspress'), 'post_type' => 'sp_player');
$tabs['sp_defense'] = array('label' => __('Defense', 'sportspress'), 'post_type' => 'sp_player');
} elseif (1 == $sections) {
$tabs['sp_defense'] = array('label' => __('Defense', 'sportspress'), 'post_type' => 'sp_player');
$tabs['sp_offense'] = array('label' => __('Offense', 'sportspress'), 'post_type' => 'sp_player');
} else {
$tabs['sp_player'] = array('label' => __('Players', 'sportspress'), 'post_type' => 'sp_player');
}
$tabs['sp_staff'] = array('label' => __('Staff', 'sportspress'), 'post_type' => 'sp_staff');
?>
<?php
if ($tabs) {
?>
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
<?php
$j = 0;
foreach ($tabs as $slug => $tab) {
?>
<li class="wp-tab<?php
if (0 == $j) {
?>
-active<?php
}
?>
"><a href="#<?php
echo $slug;
?>
-all"><?php
echo $tab['label'];
?>
</a></li>
<?php
$j++;
}
?>
</ul>
<?php
$j = 0;
foreach ($tabs as $slug => $tab) {
do_action('sportspress_event_teams_meta_box_checklist', $post->ID, $tab['post_type'], 0 == $j ? 'block' : 'none', $team, $i, $slug);
$j++;
}
?>
<?php
}
?>
</div>
<?php
}
} else {
?>
<p><strong><?php
printf(__('Select %s:', 'sportspress'), __('Teams', 'sportspress'));
?>
</strong></p>
<?php
$args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'selected' => $teams, 'values' => 'ID', 'class' => 'widefat', 'property' => 'multiple', 'chosen' => true, 'placeholder' => __('None', 'sportspress'));
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_team', __('Add New', 'sportspress'));
}
}
wp_nonce_field('sp-get-players', 'sp-get-players-nonce', false);
}
示例12: staff_gallery_shortcode
/**
* AJAX staff_gallery shortcode
*/
public function staff_gallery_shortcode()
{
?>
<div class="wrap sp-thickbox-content" id="sp-thickbox-staff_gallery">
<p>
<label>
<?php
_e('Title:', 'sportspress');
?>
<input class="regular-text" type="text" name="title">
</label>
</p>
<p>
<label>
<?php
printf(__('Select %s:', 'sportspress'), __('Directory', 'sportspress'));
?>
<?php
$args = array('post_type' => 'sp_directory', 'name' => 'id', 'values' => 'ID');
sp_dropdown_pages($args);
?>
</label>
</p>
<p>
<label>
<?php
_e('Number of staff to show:', 'sportspress');
?>
<input type="text" size="3" name="number" id="number" value="5">
</label>
</p>
<p>
<label>
<input type="checkbox" name="show_all_staff_link" id="show_all_staff_link">
<?php
_e('Display link to view all staff', 'sportspress');
?>
</label>
</p>
<?php
do_action('sportspress_ajax_shortcode_form', 'staff-gallery');
?>
<p class="submit">
<input type="button" class="button-primary" value="<?php
_e('Insert Shortcode', 'sportspress');
?>
" onclick="insertSportsPress('staff_gallery');" />
<a class="button-secondary" onclick="tb_remove();" title="<?php
_e('Cancel', 'sportspress');
?>
"><?php
_e('Cancel', 'sportspress');
?>
</a>
</p>
</div>
<?php
self::scripts();
die;
}
示例13: details
/**
* Output the details metabox
*/
public static function details($post)
{
wp_nonce_field('sportspress_save_data', 'sportspress_meta_nonce');
$limit = get_option('sportspress_tournament_rounds', '6');
$taxonomies = get_object_taxonomies('sp_tournament');
$rounds = get_post_meta($post->ID, 'sp_rounds', true);
if ($rounds === '') {
$rounds = 3;
}
$winner = get_post_meta($post->ID, 'sp_winner', true);
?>
<div>
<?php
foreach ($taxonomies as $taxonomy) {
sp_taxonomy_field($taxonomy, $post, true);
}
?>
<p><strong><?php
_e('Rounds', 'sportspress');
?>
</strong></p>
<p><input name="sp_rounds" type="number" min="1" max="<?php
echo esc_attr($limit);
?>
" value="<?php
echo $rounds;
?>
" placeholder="0" class="small-text sp-autosave"></p>
<p><strong><?php
_e('Winner', 'sportspress');
?>
</strong></p>
<p>
<?php
$args = array('show_option_none' => __('— Not set —', 'sportspress'), 'post_type' => 'sp_team', 'name' => 'sp_winner', 'selected' => $winner, 'values' => 'ID');
sp_dropdown_pages($args);
?>
</p>
</div>
<?php
}
示例14: profile
/**
* Add team selector to user profile.
*/
public function profile($user)
{
$roles = $user->roles;
$role = array_shift($roles);
if (!$this->role_is_limited($role)) {
return;
}
$teams = get_user_meta($user->ID, 'sp_team', false);
?>
<h3><?php
_e('Team Access', 'sportspress');
?>
</h3>
<table class="form-table">
<tr>
<th>
<?php
_e('Team', 'sportspress');
?>
</th>
<td>
<?php
$args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'selected' => $teams, 'values' => 'ID', 'class' => 'widefat', 'placeholder' => __('All', 'sportspress'), 'property' => 'multiple', 'chosen' => true);
sp_dropdown_pages($args);
?>
</td>
</tr>
</table>
<?php
}
示例15: output
/**
* Output the metabox
*/
public static function output($post)
{
$limit = get_option('sportspress_event_teams', 2);
$teams = (array) get_post_meta($post->ID, 'sp_team', false);
for ($i = 0; $i < $limit; $i++) {
$team = array_shift($teams);
?>
<div class="sp-instance">
<p class="sp-tab-select sp-title-generator">
<?php
$args = array('post_type' => 'sp_team', 'name' => 'sp_team[]', 'class' => 'sportspress-pages', 'show_option_none' => __('— None —', 'sportspress'), 'values' => 'ID', 'selected' => $team, 'chosen' => true, 'tax_query' => array());
if ('yes' == get_option('sportspress_event_filter_teams_by_league', 'no')) {
$league_id = sp_get_the_term_id($post->ID, 'sp_league', 0);
if ($league_id) {
$args['tax_query'][] = array('taxonomy' => 'sp_league', 'terms' => $league_id);
}
}
if ('yes' == get_option('sportspress_event_filter_teams_by_season', 'no')) {
$season_id = sp_get_the_term_id($post->ID, 'sp_season', 0);
if ($season_id) {
$args['tax_query'][] = array('taxonomy' => 'sp_season', 'terms' => $season_id);
}
}
if (!sp_dropdown_pages($args)) {
unset($args['tax_query']);
sp_dropdown_pages($args);
}
?>
</p>
<?php
$tabs = apply_filters('sportspress_event_team_tabs', array('sp_player', 'sp_staff'));
?>
<?php
if ($tabs) {
?>
<ul id="sp_team-tabs" class="wp-tab-bar sp-tab-bar">
<?php
foreach ($tabs as $index => $post_type) {
$object = get_post_type_object($post_type);
?>
<li class="wp-tab<?php
if (0 == $index) {
?>
-active<?php
}
?>
"><a href="#<?php
echo $post_type;
?>
-all"><?php
echo $object->labels->name;
?>
</a></li>
<?php
}
?>
</ul>
<?php
foreach ($tabs as $index => $post_type) {
sp_post_checklist($post->ID, $post_type, 0 == $index ? 'block' : 'none', array('sp_league', 'sp_season', 'sp_current_team'), $i);
}
?>
<?php
}
?>
</div>
<?php
}
}