WordPress.org

Forums

Testimonial Rotator
[resolved] Turning off pause-on-hover in widget (5 posts)

  1. kitchin
    Member
    Posted 1 year ago #

    I didn't see a way to turn off pause-on-hover in the widget. In version 2.0.3 it is on by default. Earlier versions do not have this feature at all, so it was off.

    The best solution would be a filter in function widget(... line 526
    After extract($args, EXTR_SKIP); there could be
    $args = apply_filters( 'testimonial_rotator_widget_args', $args );

    Next I am going to post a fix anyone can apply without hacking the plugin.

    https://wordpress.org/plugins/testimonial-rotator/

  2. kitchin
    Member
    Posted 1 year ago #

    For users, you can add this code to your theme's functions.php. You could consider this a crazy workaround, or just a typical hook into WP. This what those hooks are for!

    /*
    * Turn off pause-on-hover in Testimonial Rotator widgets.
    * Works in Testimonial Rotator 2.0.3
    * See: http://wordpress.org/support/topic/turning-off-pause-on-hover-in-widget
    * The technique is to hook into the WP code and detect the TR widget.
    */
    
    add_filter( 'widget_display_callback', 'mytheme_testimonial_rotator_filter_widget_display_callback', 10, 2);
    
    function mytheme_testimonial_rotator_filter_widget_display_callback( $instance, $thisobject ) { // , $args ) {
    	$class= is_object($thisobject) ? get_class($thisobject) : '';
    	if ( $class == 'TestimonialRotatorWidget' ) {
    		if ( is_array( $instance ) ) {   // just to be sure
    			// Note, Testimonial Rotator uses $instance as an args array in the widget, so this works.
    			// The filter can get the widget $args, but that won't help because it's read-only here.
    			$instance['no_pause_on_hover']= 1;
    		}
    	}
    	return $instance;
    }
  3. Hal Gatewood
    Member
    Plugin Author

    Posted 1 year ago #

    Just a note that I have added a filter available for the next release. I'll post more code when it's ready. This will simplify the whole process for you.

  4. Hal Gatewood
    Member
    Plugin Author

    Posted 1 year ago #

    You can now add this to your functions.php file in your theme folder:

    function hg_testimonial_rotator_hover( )
    {
      return false;
    }
    add_filter('testimonial_rotator_hover', 'hg_testimonial_rotator_hover');
  5. kitchin
    Member
    Posted 10 months ago #

    Works great, and can turn it on with an even easier one-liner:

    add_filter( 'testimonial_rotator_hover', '__return_false' );

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Testimonial Rotator
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic