WordPress.org

Ready to get started?Download WordPress

Forums

Smart YouTube PRO
Autoplay Videos only if is in a Single Post not in Front Page (2 posts)

  1. chris055
    Member
    Posted 8 months ago #

    Is there a way to autoplay videos only if they are in a single post mode, but not autoplay in the front page or the home page?

    Thanks in advance

    https://wordpress.org/plugins/smart-youtube/

  2. chris055
    Member
    Posted 8 months ago #

    I was able to find the code in smartyoutube.php of the plugin:

    $ap = '';
    		if ( is_single() ) {
    			if ( $context == 'post' && $autoplay_first && ! $this->first ) {
    				$ap = '&autoplay=1';
    				$this->first = true;
    			} else if ( ( $context == 'post' && $autoplay && ! $autoplay_first ) || ( $context == 'excerpt' && $autoplay ) ) {
    				$ap = '&autoplay=1';
    			} else {
    				$ap = '';
    			}

    replace with:

    $ap = '';
    		if ( is_single() ) {
    
    				$ap = '&autoplay=1';

    Just disable Autoplay in the Plugin options but this replacement of code will Autoplay in Single Posts.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags