• Resolved exoboy

    (@exoboy)


    I don’t need help, I fixed this for myself right now. However, I thought you should be aware of it for future version of the plugin. In the file “slide-anything-front-end.php”, on about line 1634, you are creating a JS object to send client-side. The problem I was running in to was that the JS string you generate, does not have anything in the value side of the property-value pairs if I have nothing set up for mobile. This causes Chrome to throw an error (same as the title of this post). I fixed by adding the following: // exoboy: BEGIN
    for($i=1;$i<=6;$i++)
    {
    $slide_data[‘items_width’ . $i ] = esc_attr( $slide_data[‘items_width’ . $i ] );

    if( $slide_data[‘items_width’ . $i ] == “” )
    {
    $slide_data[‘items_width’ . $i ] = ‘null’;
    }
    }
    // exoboy: END

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author simonpedge

    (@simonpedge)

    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 4 years, 9 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 4 years, 9 months ago by exoboy.
    Plugin Author simonpedge

    (@simonpedge)

    Ok, I have fixed this in version 2.3.16 – thank you for the feedback.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Unexpected Token “{” at line 972’ is closed to new replies.