• Resolved Javier

    (@javota2020)


    Hi Andrea,
    First of all thanks for your amazing day-to-day support.
    We were using BP Profile Search (with BuddyPress) with the bps-form-legacy template and Select2 during all this time, but in the new template doesn’t work.
    I copy the code that works on the bps-form-legacy template:

    $F = bps_escaped_form_data ();
    
    	wp_enqueue_script ('select2-js', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.12/js/select2.min.js', array ('jquery'));
    	wp_enqueue_style ('select2-css', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.12/css/select2.min.css');
    ?>
    <script>
    	jQuery(document).ready(function($) {
    		$('.bps_form select').select2();
    	});
    </script>
    <?php
    
    	$toggle_id = 'bps_toggle'. $F->id;
    	$form_id = 'bps_'. $F->location. $F->id;
    

    I want to know how to implement the same functionality on the new template. It is possible?
    Thanks

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Javier

    (@javota2020)

    To make it works on the previous version I just followed your instructions from this post: https://www.ads-software.com/support/topic/chosen-js-or-select2-javascript-for-multiselect-box/

    Best,

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hello Javier,

    Open the file bps-form-default.php, locate the lines:

    $F = bps_escaped_form_data ($version = '4.9');
    ?>
    
    <style>

    and replace them with:

    $F = bps_escaped_form_data ($version = '4.9');
    
    wp_enqueue_script ('select2-js', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/js/select2.min.js', array ('jquery'));
    wp_enqueue_style ('select2-css', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.5/css/select2.min.css');
    ?>
    <script>
    	jQuery(document).ready(function($) {
    		$('.bps-form select').select2();
    	});
    </script>
    
    <style>

    Please note that the only change to the old code is .bps-form instead of .bps_form.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to set up Select2 on the new template? Help’ is closed to new replies.