Home>Support>Overriding carousel-post-loop.php in Page builder

Overriding carousel-post-loop.php in Page builder

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

Hi,

Thanks for your great plugin.

I’m struggling to override carousel-post-loop.php. The carousel widget does actually what I need besides that I want to add more information over the thumbnail when I’m hovering it. Easily done by duplicating the .template file but I can’t find a way to make it work in my custom theme.

I’ve been tested a couple of locations without success:

customtheme/templates/carousel-post-loop.php

customtheme/tpl/carousel-post-loop.php

customtheme/widgets/post-carousel/tpl/carousel-post-loop.php

Hope you can help me out.

Thanks a lot.

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 8 years, 3 months ago Alex S
    Hi, I Work Here

    Hi Omp,

    The SiteOrigin Post Carousel widget uses the SiteOrigin Widgets Bundle template system so adding the post loop template to your theme sadly isn’t enough to override it. You’ll need to override it with PHP. Here’s a brief example of how to do this.

    To clarify, the template filter for the post carousel is: siteorigin_widgets_template_file_sow-post-carousel and I wouldn’t run the variable checks. All up, something like this should work:

    function mytheme_button_template_file( $filename, $instance, $widget ) {
    	$filename = get_stylesheet_directory() . '/tpl/button.php'; 
    	
    	return $filename;
    }
    add_filter( 'siteorigin_widgets_template_file_sow-post-carousel', 'mytheme_button_template_file', 10, 3 );
    
  2. 8 years, 3 months ago omp

    Thanks Alex.

    For those who’re still struggling to achieve this, here is how I make it works. The trick is not only duplicate the loop, but also the base so the variables can be fetched.

    #1, duplicate the base.php and carousel-post-loop.php from the so-widget-bundle folder to /tpl/base-carousel.php and /tpl/carousel-post-loop.php (base.php is changed into base-carousel on purpose to avoid any conflict if you plan to override more than on template)
    #2, add this to your functions.php

    function themename_carousel_template_file( $filename, $instance, $widget ) {
    	$filename = get_stylesheet_directory() . '/tpl/carousel-base.php';
    	return $filename;
    }
    add_filter( 'siteorigin_widgets_template_file_sow-post-carousel', 'themename_carousel_template_file', 10, 3 );
    

    Now you can edit your very own templates.

    Again, thanks Alex without whom I would still be searching a solution for this.

  3. 8 years, 3 months ago Alex S
    Hi, I Work Here

    Hi Omp,

    Thank you for sharing your solution! :)

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More