TICA_Events::POST_TYPE . '_widget', 'description' => 'TICA Upcoming Events', ] ); } protected function enqueue_scripts() { $type = TICA_Events::POST_TYPE; wp_enqueue_style( "{$type}-swiper-css", plugins_url( 'public/css/swiper.css', dirname( __FILE__ ) ) ); wp_enqueue_script( "{$type}-swiper-js", plugins_url( 'public/js/swiper.js', dirname( __FILE__ ) ), [ 'jquery' ] ); } protected function get_events() { $query = new WP_Query( [ 'post_type' => TICA_Events::POST_TYPE, 'posts_per_page' => -1, 'meta_key' => TICA_Events::POST_TYPE . '_from_date', 'orderby' => 'meta_value_datetime', 'order' => 'DESC', 'meta_query' => [ [ 'key' => TICA_Events::POST_TYPE . '_from_date', 'value' => date('Y-m-d'), 'type' => 'DATE', 'compare' => '>=' ] ], ] ); return $query->posts; } function widget( $args, $instance ) { $type = TICA_Events::POST_TYPE; $events = $this->get_events(); if ( ! $events ) { return; } $id = $name = $description = $class = $before_widget = $after_widget = $before_title = $after_title = $widget_id = $widget_name = ''; extract( $args ); $this->enqueue_scripts(); echo $before_widget, $before_title, 'Upcoming Events', $after_title; ?>
generate_filename() ); $resized['filename'] = substr( $resized['filename'], 0, strrpos( $resized['filename'], '-' ) ); $resized = "{$resized['dirname']}/{$resized['filename']}-{$this->image_width}x{$this->image_height}.{$resized['extension']}"; if ( ! is_file( $resized ) ) { $editor->resize( $this->image_width, $this->image_height, true ); $resized = $editor->save( $resized ); $resized = $resized['path']; } $resized = str_replace( get_home_path(), '/', $resized ); $image = get_site_url() . $resized; } else { $image = plugins_url( 'public/img/default-event-image.jpg', dirname( __FILE__ ) ); }?>

post_title ); ?>

post_excerpt ): ?>

post_excerpt, 20, '...' ) ); ?>

LEARN MORE