Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class EventToday extends WP_Widget {
- public function __construct() {
- // Instantiate the parent object
- parent::__construct(
- 'event_now', // Base ID
- 'IDF: Taking Place Today', // Name
- array( 'description' => 'Events taking place today' ) // Args
- );
- }
- public function widget( $args, $instance ) {
- if ( class_exists( 'EM_Events' ) ) { // if events plugin is enabled
- extract( $args );
- $tpn_widgettitle = "Taking place now";
- $event_now = do_shortcode( '<ul>[events_list scope="today" limit="1"]{is_current}<li>#_EVENTEDIT <a href="#_EVENTURL">#_RACENAMENOYEAR</a> ({has_category_world-cup}<a href="' . home_url() . '/races/type/world-cup/">WC</a>{/has_category_world-cup}{has_category_world-qualifying-series}<a href="' . home_url() . '/races/type/world-qualifying-series/">WQS</a>{/has_category_world-qualifying-series}) on #_{F j} in #_LOCATIONCOUNTRY #_COUNTRYFLAG</li>{/is_current}[/events_list]</ul>' );
- $event_today_args = array(
- 'scope' => 'today',
- 'orderby' => 'event_start_date,event_name',
- );
- // $event_now = EM_Events::get( $event_today_args );
- // Widget output
- if ( strlen( $event_now ) > 25 ) {
- echo $before_widget;
- if ( $tpn_widgettitle ) echo $before_title . $tpn_widgettitle . $after_title;
- // widget content
- echo $event_now;
- echo '<div><a href="' . home_url() . '/races/">All races »</a></div>';
- echo $after_widget;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement