Skip to main content
added 3 characters in body
Source Link
kaiser
  • 50.8k
  • 27
  • 150
  • 244

on click of your "Insert Shortcode" button, you'll want to use JavaScript/jQuery to see which checkboxes are checked, from which you'll create the Shortcode. after the shortcode is created, use window.send_to_editor('[shortcode]').

something like this in all:

$("#insert-shortcode").on('click',function(ev) { ev.preventDefault(); var show = ''; $(".checkboxes").each(function() { if ($(this).is(":checked")) show += $(this).val() + ","; }); window.send_to_editor('[shortcode show="' + show.substring(0,(show.length-1)) + '"]'); });

(sorry if there are no indents; mobile app)

$("#insert-shortcode").on('click',function(ev) {
    ev.preventDefault();
    var show = '';
    $(".checkboxes").each(function() {
        if ($(this).is(":checked"))
            show += $(this).val() + ",";
    });
    window.send_to_editor('[shortcode show="' + show.substring(0,(show.length-1)) + '"]');
});

not tested, but something like that should work. of course, adjust the selectors to your specific names. I made an assumption on several things, so if I skipped over a portion that you need further explaining, just let us know.

on click of your "Insert Shortcode" button, you'll want to use JavaScript/jQuery to see which checkboxes are checked, from which you'll create the Shortcode. after the shortcode is created, use window.send_to_editor('[shortcode]').

something like this in all:

$("#insert-shortcode").on('click',function(ev) { ev.preventDefault(); var show = ''; $(".checkboxes").each(function() { if ($(this).is(":checked")) show += $(this).val() + ","; }); window.send_to_editor('[shortcode show="' + show.substring(0,(show.length-1)) + '"]'); });

(sorry if there are no indents; mobile app)

not tested, but something like that should work. of course, adjust the selectors to your specific names. I made an assumption on several things, so if I skipped over a portion that you need further explaining, just let us know.

on click of your "Insert Shortcode" button, you'll want to use JavaScript/jQuery to see which checkboxes are checked, from which you'll create the Shortcode. after the shortcode is created, use window.send_to_editor('[shortcode]').

something like this in all:

$("#insert-shortcode").on('click',function(ev) {
    ev.preventDefault();
    var show = '';
    $(".checkboxes").each(function() {
        if ($(this).is(":checked"))
            show += $(this).val() + ",";
    });
    window.send_to_editor('[shortcode show="' + show.substring(0,(show.length-1)) + '"]');
});

not tested, but something like that should work. of course, adjust the selectors to your specific names. I made an assumption on several things, so if I skipped over a portion that you need further explaining, just let us know.

Source Link
Caleb
  • 2.4k
  • 1
  • 14
  • 15

on click of your "Insert Shortcode" button, you'll want to use JavaScript/jQuery to see which checkboxes are checked, from which you'll create the Shortcode. after the shortcode is created, use window.send_to_editor('[shortcode]').

something like this in all:

$("#insert-shortcode").on('click',function(ev) { ev.preventDefault(); var show = ''; $(".checkboxes").each(function() { if ($(this).is(":checked")) show += $(this).val() + ","; }); window.send_to_editor('[shortcode show="' + show.substring(0,(show.length-1)) + '"]'); });

(sorry if there are no indents; mobile app)

not tested, but something like that should work. of course, adjust the selectors to your specific names. I made an assumption on several things, so if I skipped over a portion that you need further explaining, just let us know.