本文整理汇总了PHP中tribe_get_event_cat_slugs函数的典型用法代码示例。如果您正苦于以下问题:PHP tribe_get_event_cat_slugs函数的具体用法?PHP tribe_get_event_cat_slugs怎么用?PHP tribe_get_event_cat_slugs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tribe_get_event_cat_slugs函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: event_classes
/**
* Generates and returns a set of classes for the current day
*
* @param string $classes = ''
*
* @return string Classes
*/
public function event_classes($classes = '')
{
$day = self::get_current_day();
if (!isset($day['events'])) {
return $classes;
}
$post = $day['events']->post;
// Get our wrapper classes (for event categories, organizer, venue, and defaults)
$classes = array();
$tribe_cat_slugs = tribe_get_event_cat_slugs($post->ID);
foreach ($tribe_cat_slugs as $tribe_cat_slug) {
$classes[] = 'tribe-events-category-' . $tribe_cat_slug;
}
$classes = array_merge($classes, get_post_class('', $post->ID));
if ($venue_id = tribe_get_venue_id($post->ID)) {
$classes[] = 'tribe-events-venue-' . $venue_id;
}
foreach (tribe_get_organizer_ids($post->ID) as $organizer_id) {
$classes[] = 'tribe-events-organizer-' . $organizer_id;
}
if ($day['events']->current_post + 1 == $day['events']->post_count) {
$classes[] = 'tribe-events-last';
}
return $classes;
}
示例2: tribe_events_event_classes
/**
* Prints out or returns classes on an event wrapper
*
* @category Events
* @param $event |0 post id or object
* @param $echo |true
*
* @return void or string
**/
function tribe_events_event_classes($event = 0, $echo = true)
{
global $post, $wp_query;
// May be called when the global $post object does not exist - ie during ajax loads of various views
// ... creating a dummy object allows the method to proceed semi-gracefully (interim measure only)
//If $post object doesn't exist and an $event_id wasn't specified, then use a dummy object
if (is_a('WP_Post', $event)) {
$event_id = $event->ID;
} elseif ($event !== 0) {
$event_id = $event;
} else {
$event_id = $post->ID;
}
if (!$event_id) {
return '';
}
$classes = array('hentry', 'vevent', 'type-tribe_events', 'post-' . $event_id, 'tribe-clearfix');
$tribe_cat_slugs = tribe_get_event_cat_slugs($event_id);
foreach ($tribe_cat_slugs as $tribe_cat_slug) {
if (!empty($tribe_cat_slug)) {
$classes[] = 'tribe-events-category-' . $tribe_cat_slug;
}
}
if ($venue_id = tribe_get_venue_id($event_id)) {
$classes[] = 'tribe-events-venue-' . $venue_id;
}
if ($organizer_id = tribe_get_organizer_id($event_id)) {
$classes[] = 'tribe-events-organizer-' . $organizer_id;
}
// added first class for css
if ($wp_query->current_post == 0 && !tribe_is_day()) {
$classes[] = 'tribe-events-first';
}
// added last class for css
if ($wp_query->current_post == $wp_query->post_count - 1) {
$classes[] = 'tribe-events-last';
}
$classes = apply_filters('tribe_events_event_classes', $classes);
if ($echo) {
echo implode(' ', $classes);
} else {
return implode(' ', $classes);
}
}
示例3: event_classes
/**
* Add classes to events on this view
*
* @return array
* @author Jessica Yazbek
* @since 3.0
**/
public function event_classes($classes)
{
global $post, $wp_query;
$classes = array_merge($classes, array('hentry', 'vevent', 'type-tribe_events', 'post-' . $post->ID, 'tribe-clearfix'));
$tribe_cat_slugs = tribe_get_event_cat_slugs($post->ID);
foreach ($tribe_cat_slugs as $tribe_cat_slug) {
$classes[] = 'tribe-events-category-' . $tribe_cat_slug;
}
if ($venue_id = tribe_get_venue_id($post->ID)) {
$classes[] = 'tribe-events-venue-' . $venue_id;
}
if ($organizer_id = tribe_get_organizer_id($post->ID)) {
$classes[] = 'tribe-events-organizer-' . $organizer_id;
}
// added first class for css
if ($wp_query->current_post == 0 && !tribe_is_day()) {
$classes[] = 'tribe-events-first';
}
// added last class for css
if ($wp_query->current_post == $wp_query->post_count - 1) {
$classes[] = 'tribe-events-last';
}
return $classes;
}
示例4: event_classes
/**
* css event wrapper classes used during loop
*
* @since 3.0
* @author tim@imaginesimplicty.com
* @return void
*/
function event_classes()
{
if (self::$loop_type == 'allday') {
$event = self::get_allday_event();
} else {
$event = self::get_hourly_event();
}
// Get our wrapper classes (for event categories, organizer, venue, and defaults)
echo 'hentry vevent type-tribe_events post-' . $event->ID, ' tribe-clearfix ';
// we need to adjust on behalf of weekly span scripts
$day_span_length = $event->days_between + 1;
if ($day_span_length > 0) {
echo 'tribe-dayspan' . $day_span_length . ' ';
}
// if we have a venue add the class
if ($venue_id = tribe_get_venue_id($event->ID)) {
'tribe-events-venue-' . $venue_id . ' ';
}
// if we have an organizer add the class
if ($organizer_id = tribe_get_organizer_id($event->ID)) {
$classes[] = 'tribe-events-organizer-' . $organizer_id . ' ';
}
// add classes for all assigned categories
$tribe_cat_slugs = tribe_get_event_cat_slugs($event->ID);
foreach ($tribe_cat_slugs as $tribe_cat_slug) {
echo 'tribe-events-category-' . $tribe_cat_slug . ' ';
}
if (self::$loop_type == 'hourly' && strtotime(self::$prior_event_date->EventStartDate) < strtotime($event->EventStartDate)) {
echo 'tribe-event-overlap ';
}
self::$prior_event_date->EventStartDate = $event->EventStartDate;
}