Function Reference: geodir_listing_slider_widget_output
Summary
Generates listing slider HTML.
Global Values
- $post
- (object) (required) The current post object.
- Default: None
Package
GeoDirectory
Parameters
- $args
- (array|string) (required) Display arguments including before_title, after_title, before_widget, and after_widget.
- Default: None
- $instance
- (array|string) (required) The settings for the particular instance of the widget.
- Default: None
Change Log
Since: 1.0.0
Filters
‘geodir_listing_slider_title’ [Line: 3305]
Source File
geodir_listing_slider_widget_output() is located in geodirectory-functions/general_functions.php [Line: 3054]
Source Code
function geodir_listing_slider_widget_output( $args = '', $instance = '' ) { // prints the widget extract( $args, EXTR_SKIP ); echo $before_widget; /** This filter is documented in geodirectory_widgets.php */ $title = empty( $instance['title'] ) ? '' : apply_filters( 'widget_title', __( $instance['title'], 'geodirectory' ) ); /** * Filter the widget post type. * * @since 1.0.0 * * @param string $instance ['post_type'] Post type of listing. */ $post_type = empty( $instance['post_type'] ) ? 'gd_place' : apply_filters( 'widget_post_type', $instance['post_type'] ); /** * Filter the widget's term. * * @since 1.0.0 * * @param string $instance ['category'] Filter by term. Can be any valid term. */ $category = empty( $instance['category'] ) ? '0' : apply_filters( 'widget_category', $instance['category'] ); /** * Filter widget's "add_location_filter" value. * * @since 1.0.0 * * @param string|bool $instance ['add_location_filter'] Do you want to add location filter? Can be 1 or 0. */ $add_location_filter = empty( $instance['add_location_filter'] ) ? '0' : apply_filters( 'widget_add_location_filter', $instance['add_location_filter'] ); /** * Filter the widget listings limit. * * @since 1.0.0 * * @param string $instance ['post_number'] Number of listings to display. */ $post_number = empty( $instance['post_number'] ) ? '5' : apply_filters( 'widget_post_number', $instance['post_number'] ); /** * Filter the widget listings limit shown at one time. * * @since 1.5.0 * * @param string $instance ['max_show'] Number of listings to display on screen. */ $max_show = empty( $instance['max_show'] ) ? '1' : apply_filters( 'widget_max_show', $instance['max_show'] ); /** * Filter the widget slide width. * * @since 1.5.0 * * @param string $instance ['slide_width'] Width of the slides shown. */ $slide_width = empty( $instance['slide_width'] ) ? '' : apply_filters( 'widget_slide_width', $instance['slide_width'] ); /** * Filter widget's "show title" value. * * @since 1.0.0 * * @param string|bool $instance ['show_title'] Do you want to display title? Can be 1 or 0. */ $show_title = empty( $instance['show_title'] ) ? '' : apply_filters( 'widget_show_title', $instance['show_title'] ); /** * Filter widget's "slideshow" value. * * @since 1.0.0 * * @param int $instance ['slideshow'] Setup a slideshow for the slider to animate automatically. */ $slideshow = empty( $instance['slideshow'] ) ? 0 : apply_filters( 'widget_slideshow', $instance['slideshow'] ); /** * Filter widget's "animationLoop" value. * * @since 1.0.0 * * @param int $instance ['animationLoop'] Gives the slider a seamless infinite loop. */ $animationLoop = empty( $instance['animationLoop'] ) ? 0 : apply_filters( 'widget_animationLoop', $instance['animationLoop'] ); /** * Filter widget's "directionNav" value. * * @since 1.0.0 * * @param int $instance ['directionNav'] Enable previous/next arrow navigation?. Can be 1 or 0. */ $directionNav = empty( $instance['directionNav'] ) ? 0 : apply_filters( 'widget_directionNav', $instance['directionNav'] ); /** * Filter widget's "slideshowSpeed" value. * * @since 1.0.0 * * @param int $instance ['slideshowSpeed'] Set the speed of the slideshow cycling, in milliseconds. */ $slideshowSpeed = empty( $instance['slideshowSpeed'] ) ? 5000 : apply_filters( 'widget_slideshowSpeed', $instance['slideshowSpeed'] ); /** * Filter widget's "animationSpeed" value. * * @since 1.0.0 * * @param int $instance ['animationSpeed'] Set the speed of animations, in milliseconds. */ $animationSpeed = empty( $instance['animationSpeed'] ) ? 600 : apply_filters( 'widget_animationSpeed', $instance['animationSpeed'] ); /** * Filter widget's "animation" value. * * @since 1.0.0 * * @param string $instance ['animation'] Controls the animation type, "fade" or "slide". */ $animation = empty( $instance['animation'] ) ? 'slide' : apply_filters( 'widget_animation', $instance['animation'] ); /** * Filter widget's "list_sort" type. * * @since 1.0.0 * * @param string $instance ['list_sort'] Listing sort by type. */ $list_sort = empty( $instance['list_sort'] ) ? 'latest' : apply_filters( 'widget_list_sort', $instance['list_sort'] ); $show_featured_only = ! empty( $instance['show_featured_only'] ) ? 1 : null; wp_enqueue_script( 'geodirectory-jquery-flexslider-js' ); ?> $post_number, 'is_geodir_loop' => true, 'gd_location' => $add_location_filter ? true : false, 'post_type' => $post_type, 'order_by' => $list_sort ); if ( $show_featured_only ) { $query_args['show_featured_only'] = 1; } if ( $category != 0 || $category != '' ) { $category_taxonomy = geodir_get_taxonomies( $post_type ); $tax_query = array( 'taxonomy' => $category_taxonomy[0], 'field' => 'id', 'terms' => $category ); $query_args['tax_query'] = array( $tax_query ); } // we want listings with featured image only $query_args['featured_image_only'] = 1; if ( $post_type == 'gd_event' ) { $query_args['gedir_event_listing_filter'] = 'upcoming'; }// show only upcoming events $widget_listings = geodir_get_widget_listings( $query_args ); if ( ! empty( $widget_listings ) || ( isset( $with_no_results ) && $with_no_results ) ) { if ( $title ) { echo $before_title . $title . $after_title; } global $post; $current_post = $post;// keep current post info $widget_main_slides = ''; $nav_slides = ''; $widget_slides = 0; foreach ( $widget_listings as $widget_listing ) { global $gd_widget_listing_type; $post = $widget_listing; $widget_image = geodir_get_featured_image( $post->ID, 'thumbnail', get_option( 'geodir_listing_no_img' ) ); if ( ! empty( $widget_image ) ) { if ( $widget_image->height >= 200 ) { $widget_spacer_height = 0; } else { $widget_spacer_height = ( ( 200 - $widget_image->height ) / 2 ); } $widget_main_slides .= '
1 ) { ?>