'testimonial-widget',
'description' => __('Add a slider testimonial on your widget which link a category to show the contents.', 'yiw')
);
$control_ops = array( 'id_base' => 'testimonial-widget' );
$this->WP_Widget( 'testimonial-widget', 'Testimonial Widget', $widget_ops, $control_ops );
}
function widget( $args, $instance )
{
extract( $args );
/* User-selected settings. */
if( !isset( $instance['title'] ) )
$instance['title'] = '';
$title = apply_filters('widget_title', $instance['title'] );
$test_fx = isset( $instance['test_fx']) ? $instance['test_fx'] : 'fade';
$test_easing_fx = isset( $instance['test_easing_fx']) ? $instance['test_easing_fx'] : false;
$test_timeout_fx = isset( $instance['test_timeout_fx']) ? $instance['test_timeout_fx'] : 5000;
$test_speed_fx = isset( $instance['test_speed_fx']) ? $instance['test_speed_fx'] : 500;
$test_n_items = isset( $instance['test_n_items']) ? $instance['test_n_items'] : 5;
$size = 32;
global $more, $post;
$more = 0;
$test_posts = new WP_Query("post_type=yiw_testimonials&posts_per_page=$test_n_items");
if( $test_posts->have_posts() )
{
echo $before_widget;
if ( $title ) echo $before_title . $title . $after_title;
echo '
';
echo '
';
while( $test_posts->have_posts() )
{
$test_posts->the_post();
echo '- ';
echo '
';
the_content();
the_title( '[', ' ]' );
echo '
';
echo ' ';
}
echo '
';
echo '';
echo '
';
$easing_attr = '';
if( $test_easing_fx ) $easing_attr = "easing: '$test_easing_fx',";
$script = "";
echo $script;
echo $after_widget;
}
wp_reset_query();
}
function update( $new_instance, $old_instance )
{
$instance = $old_instance;
$instance['title'] = strip_tags( $new_instance['title'] );
$instance['test_n_items'] = $new_instance['test_n_items'];
$instance['test_fx'] = $new_instance['test_fx'];
$instance['test_easing_x'] = $new_instance['test_easing_fx'];
$instance['test_timeout_fx'] = $new_instance['test_timeout_fx'];
$instance['test_speed_fx'] = $new_instance['test_speed_fx'];
return $instance;
}
function form( $instance )
{
global $yiw_icons_name, $yiw_fxs, $yiw_easings;
/* Impostazioni di default del widget */
$defaults = array(
'title' => 'yiw_testimonials',
'test_n_items' => 5,
'test_fx' => 'scrollLeft',
'test_easing_fx' => FALSE,
'test_timeout_fx' => 8000,
'test_speed_fx' => 300
);
$yiw_categories = get_categories('hide_empty=1&orderby=name');
$yiw_wp_cats = array();
foreach ($yiw_categories as $category_list )
{
$yiw_wp_cats[$category_list->category_nicename] = $category_list->cat_name;
}
$instance = wp_parse_args( (array) $instance, $defaults ); ?>