예제 #1
0
 /**
  * Outputs the content of the widget
  *
  * @param array $args
  * @param array $instance
  */
 public function widget($args, $instance)
 {
     // See if we need to hide the button
     if (!apply_filters('show_ua_webtide_widget_button', true, $instance, $args)) {
         return;
     }
     // If for members only
     if (isset($instance['for_members_only']) && $instance['for_members_only'] && !IS_WEBTIDE_MEMBER) {
         return;
     }
     // If for non-members only
     if (isset($instance['for_non_members_only']) && $instance['for_non_members_only'] && IS_WEBTIDE_MEMBER) {
         return;
     }
     // If we have linkage...
     if ($button_linkage = ua_webtide_widgets_get_linkage_a($instance)) {
         // If we're supposed to hide the button on the page it's linked to
         if (isset($instance['hide_on_link']) && $instance['hide_on_link']) {
             // Get the linkage
             if ($linkage = ua_webtide_widgets_get_linkage($instance)) {
                 // If the URLs match, get out of here
                 if (is_viewing_ua_webtide_link($linkage)) {
                     return;
                 }
             }
         }
         echo $args['before_widget'];
         echo $button_linkage . $instance['text'] . '</a>';
         echo $args['after_widget'];
     }
 }
예제 #2
0
function ua_webtide_add_calendar_menu($sidebar_id)
{
    // Only for the calendar sidebar
    if ('calendar' != $sidebar_id) {
        return;
    }
    // Only if we have terms
    $events_categories = get_terms('tribe_events_cat', array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true, 'fields' => 'all'));
    if (!$events_categories) {
        return;
    }
    // Are we viewing the main events page?
    $is_main_events_page = is_post_type_archive('tribe_events');
    ?>
<div class="widget widget_nav_menu view-events-menu">
		<h3 class="widget-title">View Events<?php 
    // Link to view all events if not on main events page
    if (!$is_main_events_page) {
        ?>
<span class="widget-title-link"><a href="https://webtide.ua.edu/events/">View all</a></span><?php 
    }
    ?>
</h3>
		<div class="menu-calendar-container">
			<ul id="menu-calendar" class="menu"><?php 
    foreach ($events_categories as $event_cat) {
        // Get the term link
        if (!($event_cat_term_link = get_term_link($event_cat, 'tribe_events_cat'))) {
            continue;
        }
        // Is this the current page?
        $current_page = is_viewing_ua_webtide_link($event_cat_term_link, !$is_main_events_page);
        ?>
<li<?php 
        echo $current_page ? ' class="current-menu-item"' : NULL;
        ?>
><a href="<?php 
        echo $event_cat_term_link;
        ?>
list/"><?php 
        echo $event_cat->name;
        ?>
</a></li><?php 
    }
    ?>
</ul>
		</div>
	</div><?php 
}
예제 #3
0
function is_viewing_ua_webtide_link_menu_condition($item)
{
    return isset($item->url) ? is_viewing_ua_webtide_link($item->url) : false;
}