defaults = array( 'title' => '', 'type' => 'slider', 'post_type' => 'post', 'category_name' => '', 'tag' => '', 'posts_per_page' => '5', 'orderby' => 'date', 'order' => 'DESC', 'image_size' => 'medium', 'link_image' => 0, 'show_caption' => 'none', 'show_content' => 'none' ); $widget_ops = array( 'classname' => 'flexslider_widget', 'description' => __( 'Responsive slider able to showcase any post type', 'acfs' ) ); parent::__construct( 'arconix-flexslider', __( 'Arconix Flexslider', 'acfs' ), $widget_ops ); } /** * Registers the widget with the WordPress Widget API. * * @since 1.0.0 */ public static function register() { register_widget( __CLASS__ ); } /** * Widget Output * * @since 0.1 * @version 1.0.1 * * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. * @param array $instance The settings for the particular instance of the widget */ function widget( $args, $instance ) { // Load the javascript if it hasn't been overridden if( wp_script_is( 'arconix-flexslider-js', 'registered' ) ) wp_enqueue_script( 'arconix-flexslider-js' ); extract( $args, EXTR_SKIP ); // Merge with defaults $instance = wp_parse_args( $instance, $this->defaults ); // Before widget (defined by themes) echo $before_widget; // Title of widget (before and after defined by themes) if( ! empty( $instance['title'] ) ) echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; // Run our query and output our results $fs = new Arconix_FlexSlider(); $fs->loop( $instance, true ); // After widget (defined by themes) echo $after_widget; } /** * Update a particular instance. * * @since 0.1 * @version 1.0.0 * * @param array $new_instance New settings for this widget as input by the user via form() * @param array $old_instance Existing settings for this widget * * @return array $new_instance Settings to save or bool false to cancel saving */ function update( $new_instance, $old_instance ) { $new_instance['title'] = strip_tags( $new_instance['title'] ); $new_instance['posts_per_page'] = absint( $new_instance['posts_per_page'] ); $new_instance['category_name'] = strip_tags( $new_instance['category_name'] ); $new_instance['tag'] = strip_tags( $new_instance['tag'] ); return $new_instance; } /** * Widget form * * @since 0.1 * @version 1.0.0 * @param array $instance Current settings */ function form( $instance ) { // Merge with defaults $instance = wp_parse_args( $instance, $this->defaults ); ?>

/>

array( 'width' => get_option( 'thumbnail_size_w' ), 'height' => get_option( 'thumbnail_size_h' ), 'crop' => get_option( 'thumbnail_crop' ), ), 'medium' => array( 'width' => get_option( 'medium_size_w' ), 'height' => get_option( 'medium_size_h' ), ), 'large' => array( 'width' => get_option( 'large_size_w' ), 'height' => get_option( 'large_size_h' ), ) ); if( $_wp_additional_image_sizes ) $additional_sizes = $_wp_additional_image_sizes; return array_merge( $builtin_sizes, $additional_sizes ); } /** * Return a modified list of Post Types * * This function is primarily geared towards developers who do work for clients and want to restrict * the post types visible in the widget drop down. The default list includes the 2 WordPress post * types plus the post type for the popular plugin Contact Form 7. The list can be filtered to * add any other desired post types * * @example https://gist.github.com/j-gardner/10469315 * * @since 0.1 * @version 0.5 * * @return array $post_types Modified post_type list */ function get_modified_post_type_list() { $post_types = get_post_types( '', 'names' ); /* Post types we want excluded from the drop down */ $excl_post_types = apply_filters( 'arconix_flexslider_exclude_post_types', array( 'revision', 'nav_menu_item', 'wpcf7_contact_form' ) ); /** Loop through and exclude the items in the list */ foreach( $excl_post_types as $excl_post_type ) { if( isset( $post_types[$excl_post_type] ) ) unset( $post_types[$excl_post_type] ); } return $post_types; } }