本文整理汇总了PHP中sp_post_adder函数的典型用法代码示例。如果您正苦于以下问题:PHP sp_post_adder函数的具体用法?PHP sp_post_adder怎么用?PHP sp_post_adder使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sp_post_adder函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
/**
* Output the metabox
*/
public static function output($post)
{
$metrics = get_post_meta($post->ID, 'sp_metrics', true);
$args = array('post_type' => 'sp_metric', 'numberposts' => -1, 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC');
$vars = get_posts($args);
if ($vars) {
foreach ($vars as $var) {
?>
<p><strong><?php
echo $var->post_title;
?>
</strong></p>
<p><input type="text" name="sp_metrics[<?php
echo $var->post_name;
?>
]" value="<?php
echo esc_attr(sp_array_value($metrics, $var->post_name, ''));
?>
" /></p>
<?php
}
} else {
sp_post_adder('sp_metric', __('Add New', 'sportspress'));
}
}
示例2: output
/**
* Output the metabox
*/
public static function output($post)
{
wp_nonce_field('sportspress_save_data', 'sportspress_meta_nonce');
$taxonomies = get_object_taxonomies('sp_table');
$select = get_post_meta($post->ID, 'sp_select', true);
if (!$select) {
global $pagenow;
$select = 'post-new.php' ? 'auto' : 'manual';
}
?>
<div>
<?php
foreach ($taxonomies as $taxonomy) {
sp_taxonomy_field($taxonomy, $post, true);
}
?>
<p><strong>
<?php
_e('Teams', 'sportspress');
?>
</strong></p>
<p class="sp-select-setting">
<select name="sp_select">
<option value="auto" <?php
selected('auto', $select);
?>
><?php
_e('Auto', 'sportspress');
?>
</option>
<option value="manual" <?php
selected('manual', $select);
?>
><?php
_e('Manual', 'sportspress');
?>
</option>
</select>
</p>
<?php
sp_post_checklist($post->ID, 'sp_team', 'auto' == $select ? 'none' : 'block', array('sp_league', 'sp_season'));
sp_post_adder('sp_team', __('Add New', 'sportspress'));
?>
</div>
<?php
}
示例3: 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');
}
示例4: 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
}
示例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: form
function form($instance)
{
$defaults = apply_filters('sportspress_widget_defaults', array('title' => '', 'id' => '', 'caption' => '', 'number' => 5, 'columns' => null, 'show_team_logo' => false, 'show_full_table_link' => true));
$instance = wp_parse_args((array) $instance, $defaults);
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$number = intval($instance['number']);
$columns = $instance['columns'];
$show_team_logo = $instance['show_team_logo'];
$show_full_table_link = $instance['show_full_table_link'];
// Action to hook into
do_action('sportspress_before_widget_template_form', $this, $instance, 'league-table');
?>
<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('caption');
?>
"><?php
_e('Heading:', 'sportspress');
?>
</label>
<input class="widefat" id="<?php
echo $this->get_field_id('caption');
?>
" name="<?php
echo $this->get_field_name('caption');
?>
" type="text" value="<?php
echo esc_attr($caption);
?>
" /></p>
<p><label for="<?php
echo $this->get_field_id('id');
?>
"><?php
printf(__('Select %s:', 'sportspress'), __('League Table', 'sportspress'));
?>
</label>
<?php
$args = array('post_type' => 'sp_table', 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'show_option_none' => __('— Select —', 'sportspress'), 'selected' => $id, 'values' => 'ID', 'class' => 'widefat');
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_table', __('Add New', 'sportspress'));
}
?>
</p>
<p><label for="<?php
echo $this->get_field_id('number');
?>
"><?php
_e('Number of teams 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 class="sp-prefs">
<?php
_e('Columns:', 'sportspress');
?>
<br>
<?php
$args = array('post_type' => 'sp_column', '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;
?>
//.........这里部分代码省略.........
示例7: 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');
?>
//.........这里部分代码省略.........
示例8: form
function form($instance)
{
$instance = wp_parse_args((array) $instance, array('title' => '', 'id' => null, 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n('Y-m-d'), 'date_to' => date_i18n('Y-m-d'), 'show_all_events_link' => false));
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$status = $instance['status'];
$date = $instance['date'];
$date_from = $instance['date_from'];
$date_to = $instance['date_to'];
$show_all_events_link = $instance['show_all_events_link'];
// Action to hook into
do_action('prosports_before_widget_template_form', $this, $instance, 'event-calendar');
?>
<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'), __('Calendar', 'prosports'));
?>
</label>
<?php
$args = array('post_type' => 'sp_calendar', 'show_option_all' => __('All', 'prosports'), 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'sp-event-calendar-select widefat');
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_calendar', __('Add New', 'prosports'));
}
?>
</p>
<p><label for="<?php
echo $this->get_field_id('status');
?>
"><?php
_e('Status:', 'prosports');
?>
</label>
<?php
$args = array('show_option_default' => __('Default', 'prosports'), 'name' => $this->get_field_name('status'), 'id' => $this->get_field_id('status'), 'selected' => $status, 'class' => 'sp-event-status-select widefat');
sp_dropdown_statuses($args);
?>
</p>
<div class="sp-date-selector sp-event-calendar-show-all-toggle<?php
if (!$id) {
?>
hidden<?php
}
?>
">
<p><label for="<?php
echo $this->get_field_id('date');
?>
"><?php
_e('Date:', 'prosports');
?>
</label>
<?php
$args = array('show_option_default' => __('Default', 'prosports'), 'name' => $this->get_field_name('date'), 'id' => $this->get_field_id('date'), 'selected' => $date, 'class' => 'sp-event-date-select widefat');
sp_dropdown_dates($args);
?>
</p>
<p class="sp-date-range<?php
if ('range' !== $date) {
?>
hidden<?php
}
?>
">
<input type="text" name="<?php
echo $this->get_field_name('date_from');
?>
" value="<?php
echo $date_from;
?>
" placeholder="yyyy-mm-dd" size="10">
:
<input type="text" name="<?php
echo $this->get_field_name('date_to');
?>
" value="<?php
echo $date_to;
?>
" placeholder="yyyy-mm-dd" size="10">
//.........这里部分代码省略.........
示例9: 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>
//.........这里部分代码省略.........
示例10: details
/**
* Output the details metabox
*/
public static function details($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);
?>
<div>
<p><strong><?php
_e('Competition', 'prosports');
?>
</strong></p>
<p>
<?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>
</div>
<?php
}
示例11: output
/**
* Output the metabox
*/
public static function output($post)
{
$taxonomies = get_object_taxonomies('sp_list');
$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);
$select = get_post_meta($post->ID, 'sp_select', true);
if (!$select) {
global $pagenow;
$select = 'post-new.php' == $pagenow ? 'auto' : 'manual';
}
?>
<div>
<?php
foreach ($taxonomies as $taxonomy) {
sp_taxonomy_field($taxonomy, $post, true);
}
?>
<?php
if (apply_filters('sportspress_list_team_selector', true)) {
?>
<p><strong><?php
_e('Team', 'sportspress');
?>
</strong></p>
<p class="sp-tab-select">
<?php
$args = array('post_type' => 'sp_team', 'name' => 'sp_team', 'show_option_all' => __('All', 'sportspress'), 'selected' => $team_id, 'values' => 'ID');
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_team', __('Add New', 'sportspress'));
}
?>
</p>
<?php
}
?>
<p><strong><?php
_e('Grouping', 'sportspress');
?>
</strong></p>
<p>
<select name="sp_grouping">
<option value="0"><?php
_e('None', 'sportspress');
?>
</option>
<option value="position" <?php
selected($grouping, 'position');
?>
><?php
_e('Position', 'sportspress');
?>
</option>
</select>
</p>
<p><strong><?php
_e('Sort by', 'sportspress');
?>
</strong></p>
<p>
<?php
$args = array('prepend_options' => array('number' => __('Squad Number', 'sportspress'), 'name' => __('Name', 'sportspress')), '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', 'sportspress');
?>
</strong></p>
<p>
<select name="sp_order">
<option value="ASC" <?php
selected('ASC', $order);
?>
><?php
_e('Ascending', 'sportspress');
?>
</option>
<option value="DESC" <?php
selected('DESC', $order);
?>
><?php
_e('Descending', 'sportspress');
?>
</option>
</select>
</p>
<p><strong><?php
_e('Players', 'sportspress');
?>
</strong></p>
<p class="sp-select-setting">
<select name="sp_select">
<option value="auto" <?php
selected('auto', $select);
?>
//.........这里部分代码省略.........
示例12: details
/**
* Output the details metabox
*/
public static function details($post)
{
$taxonomies = get_object_taxonomies('sp_directory');
$team_id = get_post_meta($post->ID, 'sp_team', true);
?>
<div>
<?php
foreach ($taxonomies as $taxonomy) {
sp_taxonomy_field($taxonomy, $post, true);
}
?>
<p><strong><?php
_e('Team', 'sportspress');
?>
</strong></p>
<p class="sp-tab-select">
<?php
$args = array('post_type' => 'sp_team', 'name' => 'sp_team', 'show_option_all' => __('All', 'sportspress'), 'selected' => $team_id, 'values' => 'ID');
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_team', __('Add New', 'sportspress'));
}
?>
</p>
</div>
<?php
}
示例13: 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 = 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) {
do_action('sportspress_event_teams_meta_box_checklist', $post->ID, $post_type, 0 == $index ? 'block' : 'none', $team, $i);
if (apply_filters('sportspress_event_teams_meta_box_default_checklist', true)) {
sp_post_checklist($post->ID, $post_type, 0 == $index ? 'block' : 'none', array('sp_league', 'sp_season', 'sp_current_team'), $i);
}
}
?>
<?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);
}
示例14: 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>
//.........这里部分代码省略.........
示例15: form
function form($instance)
{
$instance = wp_parse_args((array) $instance, array('title' => '', 'id' => null, 'caption' => '', 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n('Y-m-d'), 'date_to' => date_i18n('Y-m-d'), 'day' => '', 'number' => 5, 'order' => 'default', 'show_all_events_link' => true));
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$status = $instance['status'];
$date = $instance['date'];
$date_from = $instance['date_from'];
$date_to = $instance['date_to'];
$day = $instance['day'];
$number = intval($instance['number']);
$order = strip_tags($instance['order']);
$show_all_events_link = $instance['show_all_events_link'];
// Action to hook into
do_action('sportspress_before_widget_template_form', $this, $instance, 'event-blocks');
?>
<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('caption');
?>
"><?php
_e('Heading:', 'sportspress');
?>
</label>
<input class="widefat" id="<?php
echo $this->get_field_id('caption');
?>
" name="<?php
echo $this->get_field_name('caption');
?>
" type="text" value="<?php
echo esc_attr($caption);
?>
" /></p>
<p><label for="<?php
echo $this->get_field_id('id');
?>
"><?php
printf(__('Select %s:', 'sportspress'), __('Calendar', 'sportspress'));
?>
</label>
<?php
$args = array('post_type' => 'sp_calendar', 'show_option_all' => __('All', 'sportspress'), 'name' => $this->get_field_name('id'), 'id' => $this->get_field_id('id'), 'selected' => $id, 'values' => 'ID', 'class' => 'sp-event-calendar-select widefat');
if (!sp_dropdown_pages($args)) {
sp_post_adder('sp_calendar', __('Add New', 'sportspress'));
}
?>
</p>
<p><label for="<?php
echo $this->get_field_id('status');
?>
"><?php
_e('Status:', 'sportspress');
?>
</label>
<?php
$args = array('show_option_default' => __('Default', 'sportspress'), 'name' => $this->get_field_name('status'), 'id' => $this->get_field_id('status'), 'selected' => $status, 'class' => 'sp-event-status-select widefat');
sp_dropdown_statuses($args);
?>
</p>
<div class="sp-date-selector">
<p><label for="<?php
echo $this->get_field_id('date');
?>
"><?php
_e('Date:', 'sportspress');
?>
</label>
<?php
$args = array('show_option_default' => __('Default', 'sportspress'), 'name' => $this->get_field_name('date'), 'id' => $this->get_field_id('date'), 'selected' => $date, 'class' => 'sp-event-date-select widefat');
sp_dropdown_dates($args);
?>
</p>
<p class="sp-date-range<?php
if ('range' !== $date) {
?>
hidden<?php
}
?>
//.........这里部分代码省略.........