This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Overriding carousel-post-loop.php in Page builder

8 years ago · Last reply by Alex S 8 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

3
  1. Alex S Staff 8 years, 10 months ago

    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. omp 8 years, 10 months ago

    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. Alex S Staff 8 years, 10 months ago

    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.

Have a different question or issue?

Start New Thread