path = dirname( __file__ ); $this->cssclass = 'testimonials'; $this->description = __( 'Testimonials.', 'spyropress' ); $this->id_base = 'testimonial'; $this->name = __( 'Testimonials', 'spyropress' ); // Templates $this->templates['view-one'] = array( 'view' => 'view-one.php', 'label' =>__( 'Style One','spyropress' ) ); $this->templates['view-two'] = array( 'view' => 'view-two.php', 'label' =>__( 'Style Two','spyropress' ) ); // Fields $this->fields = array( array( 'label' => __( 'Template','spyropress' ), 'id' => 'template', 'class' => 'enable_changer section-full', 'type' => 'select', 'options' => $this->get_option_templates() ), array( 'label' => __( 'Title', 'spyropress' ), 'id' => 'title', 'type' => 'text', ), array( 'label' => __( 'Number of columns', 'spyropress' ), 'id' => 'columns', 'type' => 'range_slider', 'std' => 2, 'max' => 4 ), array( 'label' => __( 'Testimonial', 'spyropress' ), 'id' => 'testimonial', 'type' => 'repeater', 'fields' => array( array( 'label' => __( 'Testimonial', 'spyropress' ), 'id' => 'content', 'type' => 'textarea', 'rows' => 4 ), array( 'label' => __( 'Author Name', 'spyropress' ), 'id' => 'author', 'type' => 'text' ), array( 'label' => __( 'Author Designation', 'spyropress' ), 'id' => 'designation', 'type' => 'text', 'class' => 'template view-two section-full', ), array( 'label' => __( 'Image', 'spyropress' ), 'id' => 'image', 'class' => 'template view-two section-full', 'type' => 'upload' ), array( 'label' => __( 'Link Setting', 'spyropress' ), 'type' => 'toggle', ), array( 'label' => __( 'Link Text', 'spyropress' ), 'id' => 'btn_url_text', 'class' => 'section-full', 'type' => 'text' ), array( 'label' => __( 'URL/Hash', 'spyropress' ), 'id' => 'btn_url', 'class' => 'section-full', 'type' => 'text' ), array( 'type' => 'toggle_end' ), ) ) ); $this->create_widget(); } function widget( $args, $instance ){ // extracting info extract( $args );extract( $instance ); $template = isset( $instance['template'] ) ? $instance['template'] : ''; if( empty( $template ) )return; // get view to render require( $this->get_view($template) ); } function item_generator( $item, $atts ){ $btn_text = ( isset( $item['btn_url_text'] ) && !empty( $item['btn_url_text'] ) )? $item['btn_url_text'] :''; $btn_url = ( isset( $item['btn_url'] ) && !empty( $item['btn_url'] ) )? $item['btn_url'] :''; $author = (isset( $item['author'] ) && !empty( $item['author'] ) )? $item['author'] : ''; return '