本文整理汇总了PHP中tribe_get_listview_link函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_get_listview_link函数的具体用法?PHP tribe_get_listview_link怎么用?PHP tribe_get_listview_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_get_listview_link函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget_output
/**
* The main widget output function (called by the class's widget() function).
*
* @param array $args
* @param array $instance
* @param string $template_name The template name.
* @param string $subfolder The subfolder where the template can be found.
* @param string $namespace The namespace for the widget template stuff.
* @param string $pluginPath The pluginpath so we can locate the template stuff.
*/
function widget_output($args, $instance, $template_name = 'list-widget', $subfolder = 'widgets', $namespace = '/', $pluginPath = '')
{
global $wp_query, $tribe_ecp, $post;
extract($args, EXTR_SKIP);
// The view expects all these $instance variables, which may not be set without pro
$instance = wp_parse_args($instance, array('limit' => 5, 'title' => ''));
extract($instance, EXTR_SKIP);
// extracting $instance provides $title, $limit
$title = apply_filters('widget_title', $title);
if (!isset($category) || $category === '-1') {
$category = 0;
}
if (tribe_get_option('viewOption') == 'upcoming') {
$event_url = tribe_get_listview_link($category);
} else {
$event_url = tribe_get_gridview_link($category);
}
if (function_exists('tribe_get_events')) {
$args = array('eventDisplay' => 'upcoming', 'posts_per_page' => $limit);
if (!empty($category)) {
$args['tax_query'] = array(array('taxonomy' => TribeEvents::TAXONOMY, 'terms' => $category, 'field' => 'ID', 'include_children' => false));
}
$posts = tribe_get_events($args);
}
// if no posts, and the don't show if no posts checked, let's bail
if (!$posts && $no_upcoming_events) {
return;
}
/* Before widget (defined by themes). */
echo $before_widget;
/* Title of widget (before and after defined by themes). */
echo $title ? $before_title . $title . $after_title : '';
if ($posts) {
/* Display list of events. */
echo '<ol class="hfeed vcalendar">';
foreach ($posts as $post) {
setup_postdata($post);
include TribeEventsTemplates::getTemplateHierarchy('widgets/list-widget.php');
}
echo "</ol><!-- .hfeed -->";
/* Display link to all events */
echo '<p class="tribe-events-widget-link"><a href="' . $event_url . '" rel="bookmark">' . __('View All Events', 'tribe-events-calendar') . '</a></p>';
} else {
echo '<p>' . __('There are no upcoming events at this time.', 'tribe-events-calendar') . '</p>';
}
/* After widget (defined by themes). */
echo $after_widget;
wp_reset_query();
}
示例2: widget_output
function widget_output($args, $instance, $template_name = 'events-list-load-widget-display')
{
global $wp_query, $tribe_ecp, $post;
extract($args, EXTR_SKIP);
extract($instance, EXTR_SKIP);
// extracting $instance provides $title, $limit
$title = apply_filters('widget_title', $title);
if (!isset($category)) {
$category = null;
}
if (tribe_get_option('viewOption') == 'upcoming') {
$event_url = tribe_get_listview_link($category != -1 ? intval($category) : null);
} else {
$event_url = tribe_get_gridview_link($category != -1 ? intval($category) : null);
}
if (function_exists('tribe_get_events')) {
$posts = tribe_get_events('eventDisplay=upcoming&posts_per_page=' . $limit . '&eventCat=' . $category);
$template = TribeEventsTemplates::getTemplateHierarchy($template_name);
}
// if no posts, and the don't show if no posts checked, let's bail
if (!$posts && $no_upcoming_events) {
return;
}
/* Before widget (defined by themes). */
echo $before_widget;
/* Title of widget (before and after defined by themes). */
echo $title ? $before_title . $title . $after_title : '';
if ($posts) {
/* Display list of events. */
echo "<ul class='upcoming'>";
foreach ($posts as $post) {
setup_postdata($post);
include $template;
}
echo "</ul>";
/* Display link to all events */
echo '<div class="dig-in"><a href="' . $event_url . '">' . __('View All Events', 'tribe-events-calendar') . '</a></div>';
} else {
_e('There are no upcoming events at this time.', 'tribe-events-calendar');
}
/* After widget (defined by themes). */
echo $after_widget;
wp_reset_query();
}
示例3: widget
function widget($args, $instance)
{
global $wp_query, $post;
$old_post = $post;
extract($args, EXTR_SKIP);
extract($instance, EXTR_SKIP);
// extracting $instance provides $title, $limit, $no_upcoming_events, $start, $end, $venue, $address, $city, $state, $province'], $zip, $country, $phone , $cost
$title = apply_filters('widget_title', $title);
if (tribe_get_option('viewOption') == 'upcoming') {
$event_url = tribe_get_listview_link();
} else {
$event_url = tribe_get_gridview_link();
}
if (function_exists('tribe_get_events')) {
$posts = tribe_get_events('eventDisplay=upcoming&numResults=1&eventCat=' . $category);
$template = TribeEventsTemplates::getTemplateHierarchy('widget-featured-display');
}
// if no posts, and the don't show if no posts checked, let's bail
if (!$posts && isset($no_upcoming_events) && $no_upcoming_events) {
return;
}
/* Before widget (defined by themes). */
echo $before_widget;
/* Title of widget (before and after defined by themes). */
echo $title ? $before_title . $title . $after_title : '';
if ($posts) {
/* Display list of events. */
foreach ($posts as $post) {
setup_postdata($post);
include $template;
}
} else {
echo "<p>";
_e('There are no upcoming events at this time.', 'tribe-events-calendar-pro');
echo "</p>";
}
/* After widget (defined by themes). */
echo $after_widget;
$post = $old_post;
}
示例4: setup_listview_in_bar
/**
* Set up the list view in the view selector in the tribe events bar.
*
* @param array $views The current views array.
*
* @return array The modified views array.
*/
public function setup_listview_in_bar($views)
{
$views[] = array('displaying' => 'list', 'event_bar_hook' => 'tribe_events_before_template', 'anchor' => __('List', 'the-events-calendar'), 'url' => tribe_get_listview_link());
return $views;
}
示例5: tribe_events_the_header_attributes
/**
* Prints out data attributes used in the template header tags
*
* @category Events
* @param string|null $current_view
*
* @return void
* @todo move to template classes
**/
function tribe_events_the_header_attributes($current_view = null)
{
$attrs = array();
$current_view = !empty($current_view) ? $current_view : basename(tribe_get_current_template());
$attrs['data-title'] = wp_title('|', false, 'right');
switch ($current_view) {
case 'month.php':
$attrs['data-view'] = 'month';
$attrs['data-date'] = date('Y-m', strtotime(tribe_get_month_view_date()));
$attrs['data-baseurl'] = tribe_get_gridview_link(false);
break;
case 'day.php':
$attrs['data-startofweek'] = get_option('start_of_week');
break;
case 'list.php':
$attrs['data-startofweek'] = get_option('start_of_week');
$attrs['data-view'] = 'list';
if (tribe_is_upcoming()) {
$attrs['data-baseurl'] = tribe_get_listview_link(false);
} elseif (tribe_is_past()) {
$attrs['data-view'] = 'past';
$attrs['data-baseurl'] = tribe_get_listview_past_link(false);
}
break;
}
if (has_filter('tribe_events_mobile_breakpoint')) {
$attrs['data-mobilebreak'] = tribe_get_mobile_breakpoint();
}
$attrs = apply_filters('tribe_events_header_attributes', $attrs, $current_view);
foreach ($attrs as $attr => $value) {
echo " {$attr}=" . '"' . esc_attr($value) . '"';
}
}
示例6: tribe_get_next_month_text
'>
<?php
echo tribe_get_next_month_text();
?>
→
</a>
<img src="<?php
echo esc_url(admin_url('images/wpspin_light.gif'));
?>
" class="ajax-loading" id="ajax-loading" alt="" style='display: none'/>
</span>
</span>
<span class='tribe-events-calendar-buttons'>
<a class='tribe-events-button-off' href='<?php
echo tribe_get_listview_link();
?>
'><?php
_e('Event List', 'tribe-events-calendar');
?>
</a>
<a class='tribe-events-button-on' href='<?php
echo tribe_get_gridview_link();
?>
'><?php
_e('Calendar', 'tribe-events-calendar');
?>
</a>
</span>
</div><!-- tribe-events-calendar-header -->
<?php
示例7: tribe_events_the_header_attributes
/**
* Prints out data attributes used in the template header tags
*
* @param string|null $current_view
* @return void
* @since 3.0
**/
function tribe_events_the_header_attributes($current_view = null)
{
$attrs = array();
$current_view = !empty($current_view) ? $current_view : basename(tribe_get_current_template());
$attrs['data-title'] = wp_title('»', false);
switch ($current_view) {
case 'month.php':
$attrs['data-view'] = 'month';
$attrs['data-date'] = date('Y-m', strtotime(tribe_get_month_view_date()));
$attrs['data-baseurl'] = tribe_get_gridview_link(false);
break;
case 'list.php':
$attrs['data-view'] = 'list';
if (tribe_is_upcoming()) {
$attrs['data-baseurl'] = tribe_get_listview_link(false);
} elseif (tribe_is_past()) {
$attrs['data-view'] = 'past';
$attrs['data-baseurl'] = tribe_get_listview_past_link(false);
}
break;
}
$attrs = apply_filters('tribe_events_header_attributes', $attrs, $current_view);
foreach ($attrs as $attr => $value) {
echo " {$attr}=" . '"' . $value . '"';
}
}
示例8: sp_get_listview_link
/**
* @deprecated
*/
function sp_get_listview_link($term = null)
{
_deprecated_function(__FUNCTION__, '2.0', 'tribe_get_listview_link()');
return tribe_get_listview_link($term);
}
示例9: printf
?>
" rel="prev"><?php
printf(__('<span>«</span> Previous %s', 'tribe-events-calendar'), $events_label_plural);
?>
</a>
</li><!-- .tribe-events-nav-left -->
<?php
}
?>
<!-- Right Navigation -->
<?php
if (tribe_has_next_event()) {
?>
<li class="<?php
echo tribe_right_navigation_classes();
?>
">
<a href="<?php
echo esc_url(tribe_get_listview_link());
?>
" rel="next"><?php
printf(__('Next %s <span>»</span>', 'tribe-events-calendar'), $events_label_plural);
?>
</a>
</li><!-- .tribe-events-nav-right -->
<?php
}
?>
</ul>
示例10: tribe_get_listview_dir_link
/**
* Link to a nearby List View page
*
* Returns a link to the next/previous list view page
*
* @param string $direction 'next' or 'prev'
* @param int|null $term Term ID
* @param string $currently_displaying Type of listview page that is currently being displayed ('past' or 'list')
* @param int $page Current page number being displayed
*
* @return string URL
*/
function tribe_get_listview_dir_link($direction = 'next', $term = null, $currently_displaying = null, $page = null)
{
$link = tribe_get_listview_link($term);
// if a page isn't passed in, attempt to fetch it from a get var
if (!$page) {
if (!empty($_POST['tribe_paged'])) {
$page = absint($_POST['tribe_paged']);
} elseif (!empty($_GET['tribe_paged'])) {
$page = absint($_GET['tribe_paged']);
} else {
$page = 1;
}
}
// if what we are currently displaying is not passed in, let's set a default and check $_GET
if (!$currently_displaying) {
$currently_displaying = 'list';
if (!empty($_GET['tribe_event_display']) && 'past' === $_GET['tribe_event_display'] || !empty($_POST['tribe_event_display']) && 'past' === $_POST['tribe_event_display']) {
$currently_displaying = 'past';
}
}
// assume we want to display what we're currently displaying (until we discover otherwise)
$display = $currently_displaying;
if ('next' === $direction && 'list' === $currently_displaying || 'prev' === $direction && 'past' === $currently_displaying) {
$page++;
} elseif ('list' === $currently_displaying && 1 === $page) {
$display = 'past';
} elseif ('past' === $currently_displaying && 1 === $page) {
$display = 'list';
} else {
$page--;
}
$link = add_query_arg(array('tribe_event_display' => $display, 'tribe_paged' => $page), $link);
return apply_filters('tribe_get_listview_dir_link', $link, $term);
}