WordPress.org

Forums

The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

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

  1. chris055
    Member
    Posted 2 years 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 2 years 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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags