Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #2993699
Video Posts
Closed

Comments

  • masih143 started the conversation

    Hello, I need some help, I'm working on a site where most of its contents are videos so I'm using the post video type for it and I have around 4 sections on the home page for videos, as these videos required a video URL from youtube or vimo, but these videos are not playing in the home page the user needs to click on the feature image or title to go to the single post page and watch the video there, my main concern is as these videos are not playing in the home page still they way trying to load the videos from youtube because my site takes so much time to load as I checked the main reason for the delay in loading the youtube video in the backend, is there any way to stop loading the videos in the home page just load the video in the single post page because it's so sensitive issue for me and the site took so long to load.

    I hope I made clear what I wanted to say,

    waiting for your response, Thanks in Advance 

  •  2,610
    PenciDesign replied

    Hi,

    Please go to your dashboard → Plugins → Plugin File Editor:

    Select plugin to edit: Penci Shortcodes & Performance,

    Click the init.php file, then scroll down to the bottom:

    Find and delete:

    add_action( 'wp_enqueue_scripts', function () {
        wp_enqueue_script( 'youtube-api', 'https://www.youtube.com/iframe_api', '', '1.0', true );
        wp_enqueue_script( 'penci-play-js', plugin_dir_url( __FILE__ ) . 'assets/play.js', [ 'youtube-api' ], '1.0', true );
    } );

    You should delete this script if your site doesn't include any youtube videos.

    uGCf7wu.png

    You need to repeat this step when updating this plugin to the latest version.

    Regards,
    PenciDesign.


  • masih143 replied

    it disabled youtube videos all over the site I don't want that I just want to don't load the youtube video in the background  just the in home page see the attachment the same thing as in your soledad-video demo 

  •  2,610
    PenciDesign replied

    Hi,

    Following your request, you can modify the script on init.php like below:

    add_action( 'wp_enqueue_scripts', function () {
        if ( !is_home() || !is_front_page() ){
            wp_enqueue_script( 'youtube-api', 'https://www.youtube.com/iframe_api', '', '1.0', true );
            wp_enqueue_script( 'penci-play-js', plugin_dir_url( __FILE__ ) . 'assets/play.js', [ 'youtube-api' ], '1.0', true );
        }
    } );

    OR you can install the Code Snippet, then create a new snippet with the following content:

    add_action( 'wp_enqueue_scripts', function () {
        if ( is_home() || is_front_page()) {
            wp_dequeue_script( 'youtube-api');
            wp_dequeue_script( 'penci-play-js' );
        }
    } );

    Regards,
    PenciDesign.