• Resolved sujanm

    (@sujanm)


    I need to customize the template which is supplied. Is there a recommended way I can customize the gallery template so that it won’t be overwritten on plugin updates.
    Alternatively I can create a new theme which the classic theme. Is there a way in the shortcode I can specify which theme to use?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor wpvideogallery

    (@wpvideogallery)

    Yes, this is possible ??

    Assuming your custom theme name is “custom”.

    1. Copy our classic theme file /wp-content/plugins/automatic-youtube-gallery/public/templates/theme-classic.php to your custom theme location, rename it as you like, and apply your changes.

    2. Then, add the following code to the bottom of your theme’s functions.php file,

    function automatic_youtube_gallery_custom_template( $template, $theme ) {
    	if ( false !== strpos( $template, '/theme-classic.php' ) ) {
    		// theme = custom
    		if ( 'custom' == $theme ) {
    			$template = 'theme-custom.php';
    		}
    	}
    
    	// return
    	return $template;
    }
    add_filter( 'ayg_load_template', 'automatic_youtube_gallery_custom_template', 99, 2 );

    Note: You must replace the $template variable with your custom theme file path.

    3. Finally, add the attribute theme=”custom” in your shortcode.

    Example:
    [automatic_youtube_gallery theme="custom" ...]

    That’s it. Hope this helped you!

    Thread Starter sujanm

    (@sujanm)

    Awesome! Thanks for the reply. I’ll give it a try.

    Thread Starter sujanm

    (@sujanm)

    I tried it, and it worked well. Thank-you for the guidance.

    Plugin Contributor wpvideogallery

    (@wpvideogallery)

    I am happy that you got this working. Our next version is released in a few minutes and it introduces some changes to our template files. Also, our gallery script files are completely rewritten. Actually, these changes should not affect your custom theme. But, still, we would recommend testing your changes in a staging environment before updating the plugin in your live website.

    Please feel free to contact us if you had any issues.

    Thread Starter sujanm

    (@sujanm)

    I upgraded to the newest version and I can confirm that the customizations I made were not lost and seem to work fine. Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Template Customization’ is closed to new replies.