Comments Emma started the conversationMay 26, 2021 at 11:04amIs it possible to display an image placeholder or default imageĀ in the box grid layout if an image isn't provided for an event? 894Zhivko repliedMay 27, 2021 at 3:42pmHi,Yes, via filter.Open your theme or child-theme functions.php file and place following hook: add_action('wp_footer', function() { if ( !wp_script_is('stec-js') ) { return; } ?> <script type="text/javascript"> (function ($) { /* CONFIG */ const IMAGE_SRC = 'https://stachethemes.com/wp-demos/the-calendar/wp-content/uploads/sites/13/2018/09/sas.jpg'; const THUMB_SRC = 'https://stachethemes.com/wp-demos/the-calendar/wp-content/uploads/sites/13/2018/09/sas-300x137.jpg'; /* END OF CONFIG */ $(function () { $.stecExtend(function (m) { if (m.glob.options.view === 'boxgrid') { const events = []; $.each(m.calData.filterGetEvents, function () { const event = {...this}; if (event.images.length <= 0) { event.images.push(0); event.images_meta.push({ alt: "", caption: "", description: "", id: 0, src: IMAGE_SRC, thumb: THUMB_SRC, title: "" }); } events.push(this); }); m.calData.filterGetEvents = events; } }, 'beforeReturnGetEvents'); }); })(window.jQuery); </script> <?php }); Just change the images urls to your desired image where it says "CONFIG..." Stachethemes Developer Sign in to reply ...
Is it possible to display an image placeholder or default imageĀ in the box grid layout if an image isn't provided for an event?
Hi,
Yes, via filter.
Open your theme or child-theme functions.php file and place following hook:
Just change the images urls to your desired image where it says "CONFIG..."
Stachethemes Developer