Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class ComingEvents extends WP_Widget {
- function ComingEvents() {
- // Instantiate the parent object
- parent::__construct(
- 'coming_events', // Base ID
- 'IDF: Coming Events', // Name
- array( 'description' => 'Custom widget for coming events' ) // Args
- );
- }
- function widget( $args, $instance ) {
- if ( class_exists('EM_Events') ) { // if events plugin is enabled
- // Widget output
- extract( $args );
- $tc_widgettitle = "Next race";
- $coming_events = do_shortcode('<ul>[events_list scope="future" limit="1" orderby="event_start_date,event_name"]<li>#_EVENTEDIT #_EVENTLINK ({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} {has_location}in #_LOCATIONCOUNTRY #_COUNTRYFLAG{/has_location}</li>[/events_list]</ul>');
- if ( strlen($coming_events) > 25 ) {
- echo $before_widget;
- if ( $tc_widgettitle ) echo $before_title . $tc_widgettitle . $after_title;
- // widget content
- echo $coming_events;
- echo '<div><a href="'.home_url().'/races/">All races »</a></div>';
- echo $after_widget;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment