本文整理汇总了PHP中sp_get_template函数的典型用法代码示例。如果您正苦于以下问题:PHP sp_get_template函数的具体用法?PHP sp_get_template怎么用?PHP sp_get_template使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sp_get_template函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
/**
* Output the player list shortcode.
*
* @param array $atts
*/
public static function output($atts)
{
if (!isset($atts['id']) && isset($atts[0]) && is_numeric($atts[0])) {
$atts['id'] = $atts[0];
}
sp_get_template('player-list.php', $atts);
}
示例2: widget
function widget($args, $instance)
{
extract($args);
$id = empty($instance['id']) ? 0 : $instance['id'];
if ($id <= 0) {
return;
}
if ('yes' == get_option('sportspress_widget_unique', 'no') && get_the_ID() === $id) {
$format = get_post_meta($id, 'sp_format', true);
if ('gallery' == $format) {
return;
}
}
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$number = empty($instance['number']) ? null : $instance['number'];
$columns = empty($instance['columns']) ? null : $instance['columns'];
$orderby = empty($instance['orderby']) ? 'default' : $instance['orderby'];
$order = empty($instance['order']) ? 'ASC' : $instance['order'];
$show_all_players_link = empty($instance['show_all_players_link']) ? false : $instance['show_all_players_link'];
do_action('sportspress_before_widget', $args, $instance, 'player-gallery');
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
// Action to hook into
do_action('sportspress_before_widget_template', $args, $instance, 'player-gallery');
sp_get_template('player-gallery.php', array('id' => $id, 'title' => $caption, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby, 'order' => $order, 'grouping' => 0, 'show_all_players_link' => $show_all_players_link));
// Action to hook into
do_action('sportspress_after_widget_template', $args, $instance, 'player-gallery');
echo $after_widget;
do_action('sportspress_after_widget', $args, $instance, 'player-gallery');
}
示例3: widget
function widget($args, $instance)
{
extract($args);
$id = empty($instance['id']) ? null : $instance['id'];
if ($id && 'yes' == get_option('sportspress_widget_unique', 'no') && get_the_ID() === $id) {
$format = get_post_meta($id, 'sp_format', true);
if ('blocks' == $format) {
return;
}
}
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$status = empty($instance['status']) ? 'default' : $instance['status'];
$date = empty($instance['date']) ? 'default' : $instance['date'];
$date_from = empty($instance['date_from']) ? 'default' : $instance['date_from'];
$date_to = empty($instance['date_to']) ? 'default' : $instance['date_to'];
$day = empty($instance['day']) ? 'default' : $instance['day'];
$number = empty($instance['number']) ? null : $instance['number'];
$order = empty($instance['order']) ? 'default' : $instance['order'];
$show_all_events_link = empty($instance['show_all_events_link']) ? false : $instance['show_all_events_link'];
do_action('sportspress_before_widget', $args, $instance, 'event-blocks');
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
// Action to hook into
do_action('sportspress_before_widget_template', $args, $instance, 'event-blocks');
sp_get_template('event-blocks.php', array('id' => $id, 'title' => $caption, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'day' => $day, 'number' => $number, 'order' => $order, 'show_all_events_link' => $show_all_events_link));
// Action to hook into
do_action('sportspress_after_widget_template', $args, $instance, 'event-blocks');
echo $after_widget;
do_action('sportspress_after_widget', $args, $instance, 'event-blocks');
}
示例4: output
/**
* Output the league table shortcode.
*
* @param array $atts
*/
public static function output($atts)
{
if (!isset($atts['id']) && isset($atts[0]) && is_numeric($atts[0])) {
$atts['id'] = $atts[0];
}
sp_get_template('league-table.php', $atts);
}
示例5: widget
function widget($args, $instance)
{
extract($args);
$id = empty($instance['id']) ? 0 : $instance['id'];
if ($id <= 0) {
return;
}
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$number = empty($instance['number']) ? null : $instance['number'];
$columns = empty($instance['columns']) ? array() : $instance['columns'];
$show_team_logo = empty($instance['show_team_logo']) ? false : $instance['show_team_logo'];
$show_full_table_link = empty($instance['show_full_table_link']) ? false : $instance['show_full_table_link'];
do_action('sportspress_before_widget', $args, $instance, 'league-table');
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
// Action to hook into
do_action('sportspress_before_widget_template', $args, $instance, 'league-table');
sp_get_template('league-table.php', array('id' => $id, 'title' => $caption, 'number' => $number, 'columns' => $columns, 'show_full_table_link' => $show_full_table_link, 'show_team_logo' => $show_team_logo));
// Action to hook into
do_action('sportspress_after_widget_template', $args, $instance, 'league-table');
echo $after_widget;
do_action('sportspress_after_widget', $args, $instance, 'league-table');
}
示例6: widget
function widget($args, $instance)
{
extract($args);
$id = empty($instance['id']) ? 0 : $instance['id'];
if ($id <= 0) {
return;
}
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$number = empty($instance['number']) ? null : $instance['number'];
$columns = empty($instance['columns']) ? null : $instance['columns'];
$orderby = empty($instance['orderby']) ? 'default' : $instance['orderby'];
$order = empty($instance['order']) ? 'ASC' : $instance['order'];
$show_all_players_link = empty($instance['show_all_players_link']) ? false : $instance['show_all_players_link'];
$show_names_on_hover = empty($instance['show_names_on_hover']) ? false : $instance['show_names_on_hover'];
do_action('sportspress_before_widget', $args, $instance, 'player-gallery');
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
// Action to hook into
do_action('sportspress_before_widget_template', $args, $instance, 'player-gallery');
sp_get_template('player-gallery.php', array('id' => $id, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby, 'order' => $order, 'grouping' => 0, 'show_all_players_link' => $show_all_players_link, 'show_names_on_hover' => $show_names_on_hover));
// Action to hook into
do_action('sportspress_after_widget_template', $args, $instance, 'player-gallery');
echo $after_widget;
do_action('sportspress_after_widget', $args, $instance, 'player-gallery');
}
示例7: output
/**
* Output the event blocks shortcode.
*
* @param array $atts
*/
public static function output($atts)
{
if (!isset($atts['id']) && isset($atts[0]) && is_numeric($atts[0])) {
$atts['id'] = $atts[0];
}
sp_get_template('event-blocks.php', $atts);
}
示例8: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$id = empty($instance['id']) ? null : $instance['id'];
$status = empty($instance['status']) ? 'default' : $instance['status'];
$date = empty($instance['date']) ? 'default' : $instance['date'];
$date_from = empty($instance['date_from']) ? 'default' : $instance['date_from'];
$date_to = empty($instance['date_to']) ? 'default' : $instance['date_to'];
$number = empty($instance['number']) ? null : $instance['number'];
$columns = empty($instance['columns']) ? null : $instance['columns'];
$order = empty($instance['order']) ? 'default' : $instance['order'];
$show_all_events_link = empty($instance['show_all_events_link']) ? false : $instance['show_all_events_link'];
do_action('sportspress_before_widget', $args, $instance, 'event-list');
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
// Action to hook into
do_action('sportspress_before_widget_template', $args, $instance, 'event-list');
sp_get_template('event-list.php', array('id' => $id, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'columns' => $columns, 'order' => $order, 'show_all_events_link' => $show_all_events_link));
// Action to hook into
do_action('sportspress_after_widget_template', $args, $instance, 'event-list');
echo $after_widget;
do_action('sportspress_after_widget', $args, $instance, 'event-list');
}
示例9: output
/**
* Output the sponsors shortcode.
*
* @param array $atts
*/
public static function output($atts)
{
ob_start();
echo '<div class="sportspress">';
sp_get_template('sponsors.php', $atts, '', SP_SPONSORS_DIR . 'templates/');
echo '</div>';
return ob_get_clean();
}
示例10: output
/**
* Output the staff shortcode.
*
* @param array $atts
*/
public static function output($atts)
{
if (!isset($atts['id']) && isset($atts[0]) && is_numeric($atts[0])) {
$atts['id'] = $atts[0];
}
sp_get_template('staff-photo.php', $atts);
sp_get_template('staff-details.php', $atts);
}
示例11: add_content
public function add_content($content, $template, $append = false)
{
ob_start();
$template = sp_get_template('content-single-tournament.php', array(), 'content-single-tournament', SP_TOURNAMENTS_DIR . 'templates/');
if ($append) {
return $content . ob_get_clean();
} else {
return ob_get_clean() . $content;
}
}
示例12: add_content
public function add_content($content, $template, $append = false)
{
ob_start();
$template = sp_get_template('content-single-directory.php', array(), 'content-single-directory', SP_STAFF_DIRECTORIES_DIR . 'templates/');
if ($append) {
return $content . ob_get_clean();
} else {
return ob_get_clean() . $content;
}
}
示例13: output
/**
* Output the staff gallery shortcode.
*
* @param array $atts
*/
public static function output($atts)
{
if (!isset($atts['id']) && isset($atts[0]) && is_numeric($atts[0])) {
$atts['id'] = $atts[0];
}
ob_start();
echo '<div class="prosports">';
sp_get_template('staff-gallery.php', $atts, 'staff-gallery', SP_STAFF_DIRECTORIES_DIR . 'templates/');
echo '</div>';
return ob_get_clean();
}
示例14: output
/**
* Output the tournament_bracket shortcode.
*
* @param array $atts
*/
public static function output($atts)
{
if (!isset($atts['id']) && isset($atts[0]) && is_numeric($atts[0])) {
$atts['id'] = $atts[0];
}
ob_start();
echo '<div class="sportspress">';
sp_get_template('tournament-bracket.php', $atts, '', SP_TOURNAMENTS_DIR . 'templates/');
echo '</div>';
return ob_get_clean();
}
示例15: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? null : $instance['title'], $instance, $this->id_base);
$id = empty($instance['id']) ? null : $instance['id'];
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
// Action to hook into
do_action('prosports_before_widget_template', $args, $instance, 'staff');
sp_get_template('staff-photo.php', array('id' => $id));
sp_get_template('staff-details.php', array('id' => $id));
// Action to hook into
do_action('prosports_after_widget_template', $args, $instance, 'staff');
echo $after_widget;
}