JSFiddle - React, Tailwind, and code Playground

by fparent

HTML

// create shortcode to list all clothes which come in blue
add_shortcode( 'show_clinic_list', 'clinics_listing_shortcode' );
function clinics_listing_shortcode( $atts ) {
    $prefix = '_cmb_';

    echo 'in the custom shortcode';

    ob_start();
    $query = new WP_Query( array(
        'post_type'         => 'clinics',
        'posts_per_page'    => -1,
    ));

    if ( $query->have_posts() ) {
        echo '<select class="clinic-list" multiple>';

        while ( $query->have_posts() ) : $query->the_post();

        global $post;
        ?>

        <option class="clinic" value="<?= the_ID(); ?>"><?php the_field('clinic_name'); ?></option>

        <?php endwhile;

        echo '</select>';

        wp_reset_postdata();
    }
}