I need to use a different template for the widget “Post Carousel” and “Blog” the SiteOrigin Widgets Bundle.
I managed to bring the content from a Custom Post Type (pods), but now I need to be able to use that new template on the site.
I am using the Corp’s child theme
Greetings
Hi Agustín
Thanks for getting in touch.
Alex has prepared a PR to allow for a custom template to be added to the Blog Widget. You can keep an eye on the PR for merging here.
The Carousel Addon in SiteOrigin Premium adds a new Overlay template to the Post Carousel Widget: Page: Carousel.
I’m not sure whether the Post Carousel has a filter for adding a custom template. I’ll ask Alex to reply.
I am trying to use the “PR” but it is not working, does the new file have to be in the same folder (of the widget) or in the child theme?
I’m waiting if there is any news about the Post Carousel Widget
Thanks
Hi Agustín,
It’s possible to load additional templates for the SiteOrigin Post Carousel widget by using the siteorigin_widgets_template_variables_sow-post-carousel and siteorigin_post_carousel_ajax_item_template filters. The following code will override the template and set it to test.php.
add_filter( 'siteorigin_widgets_template_variables_sow-post-carousel', function( $template_vars, $instance ) { $template_vars['settings']['item_template'] = get_stylesheet_directory() . 'post-carousel/test.php'; return $template_vars; }, 10, 2 ); add_filter( 'siteorigin_post_carousel_ajax_item_template', function( $template, $instance ) { $template_vars['settings']['item_template'] = get_stylesheet_directory() . 'post-carousel/test.php'; return $template; }, 10, 2 );Kind regards,
Alex
Thank you very much for the answers, but I ran into some problems.
Regarding the blog function, it doesn’t load the template, I don’t know if the file is misplaced or what it could be.
Regarding the carrousel function, it works, but it does not load the content, the template I am using is the original one but modified to show other fields. What could be happening?
Thanks
Hi Agustín,
The PR Andrew linked for the Blog widget template replacement is not currently available in the release version so the filter in the linked thread won’t work yet.
Regarding the Carousel function, if you revert your changes, does it work as expected? If you’ve duplicated the Widget Bundle templates it should work as expected.
Please note that we can only provide limited assistance here due to the scope of our free support. SiteOrigin Premium includes more comprehensive technical support.
Kind regards,
Alex
Thank you for your answers.
Indeed, if I deactivate the function, the content reappears.
Hi Agustín,
Sorry, by changes I mean the changes to the copied template. You mentioned you copied the original template and then made changes. Did it work before making changes?
If it did, that suggests an error was introduced during the modifications.
If it didn’t work, that suggests an inclusion issue and I recommend checking the path to the file is correct.
Kind regards,
Alex
First of all, Happy Holidays!
I tried to use the original file and it still does not load, which leads me to the conclusion that the file location is incorrect.
Does the function bring the path of the theme child? (I put the function in the function.php thel child theme).
Thanks
Hi Agustín,
You’ll need to provide the absolute path and file name for the template. If you’re adding the template using a theme, you can use get_stylesheet_directory to make this a little easier.
Kind regards,
Alex