Yes, but the 6 Item Width metadata fields will always contain a value (1 to 12).
Within the Slider Settings page you have the 6 ‘Items Displayed’ drop-downs, which contain only 12 options (1 through 12), with each select being set to a default value of ‘1’. If you are getting an empty string for one of these 6 metadata fields, then something really weird is going on.
I mean I can put your code in there – its not doing any harm & is just an extra check – but it bugs me to not know why/where these metadata fields are becoming empty strings. When the settings POST variables are saved an “intval()” function is also applied, so any empty string will get converted to ‘0’:
update_post_meta($post->ID, 'sa_items_width1', abs(intval($_POST['sa_items_width1'])));
(redundant code as these values should never contain anything other than the 12 available options)
-
This reply was modified 5 years, 8 months ago by
simonpedge.
Thread Starter
exoboy
(@exoboy)
Thanks for the response. It is weird I went back to confirm the error message in the console and now it does not come up. I will let you know if I find it again. My guess at this point would be that something happened to my PHP session cookie, causing the value to get lost in the POST global var. I tried it in Chrome and Safari and it checks out fine now.
Thread Starter
exoboy
(@exoboy)
So, I just figured out how to replicate the issue: I have a live site and a dev version for a client. When I use a shortcode for slide anything that does not exist on the dev site, it displays this in the page’s source code:
jQuery(document).ready(function() {
jQuery(‘#’).owlCarousel({
responsive:{
0:{ items: },
480:{ items: },
768:{ items: },
980:{ items: },
1200:{ items: },
1500:{ items: }
},
autoplay : false,
autoplayHoverPause : false,
smartSpeed : 0,
fluidSpeed : 0,
autoplaySpeed : 0,
navSpeed : 0,
dotsSpeed : 0,
loop : false,
nav : false,
navText : [”,”],
dots : false,
responsiveRefreshRate : 200,
slideBy : 1,
mergeFit : true,
autoHeight : false,
mouseDrag : false,
touchDrag : false
});
jQuery(‘#’).css(‘visibility’, ‘visible’);
});
Not sure if this something worth fixing, but I am probably not the first person to use the wrong short code. It would be awesome if I could edit/assign my own label for the shortcode instead of using the next ID in the database. Because, for now, I cannot see the slider on the dev site unless I alter the sortcode manually.
-
This reply was modified 5 years, 8 months ago by
exoboy.
Ok, I have fixed this in version 2.3.16 – thank you for the feedback.