Rick
Rick

Reputation: 21

ACF custom field type not appearing on backend - jQuery error on ion range slider

Wordpress and ACF custom field type.

I've been trying to use the ACF custom field type plugin to add an ion range slider, (including on the front end form) I get a jQuery error and the slider just displays as an empty text field.

It throws a different error depending on whether the function is referenced from the front end (on a form) or the backend (admin console). This is the basic code:

        <script>
    
    min=            "<?php echo $field['min'] ?>",   
    max=            "<?php echo $field['max'] ?>",  
    type=           "<?php echo $field['handles'] ?>",
    skin=           "<?php echo $field['skin'] ?>",
    step=           "<?php echo $field['step'] ?>",
    from=           "<?php echo $field['from'] ?>",
    to=             "<?php echo $field['to'] ?>";
    
    j$ = jQuery.noConflict();    
    j$(".js-range-slider").ionRangeSlider({
        type:type,
        skin:skin,
        min:min,
        max:max,
        step:step,
        from:from,
        to:to
    });
    
    </script>

The back end works (i.e the range slider appears on the admin console.) But on the front end (a form input) it throws and error

Console

I'm not in any sense JQuery coder so this has me stumped. Do the JQuery gurus have any ideas?

Upvotes: 1

Views: 763

Answers (1)

Rick
Rick

Reputation: 21

This is caused by a issue with the acf plugin template. The path statements for enqueuing scripts are poorly done. Recoded them and now its all working great.

On the front end

enter image description here

and on the back end..

enter image description here

Upvotes: 0

Related Questions