Adding option values as an array using a multi selectable select box
It’s a lot simpler than that: <select name=”swcs_postpage_id[]” id=”swcs_postpage_id” multiple> See those brackets? Boom.
It’s a lot simpler than that: <select name=”swcs_postpage_id[]” id=”swcs_postpage_id” multiple> See those brackets? Boom.
You need to define $wpdb as global. Try this code. global $wpdb; $mail = $_POST[’email’]; $table = $wpdb->prefix . ‘members’; $result = $sql->get_results( “SELECT * FROM $table WHERE email = %s”, $mail);
As Tim Malone said, WP_Query isn’t going to return multiple copies of the same post in its result set. I think you have a design problem and I would suggest you use parent/child posts rather than post meta to accomplish what you want. The following is one approach to doing this. First, register both post … Read more
First, in order to enqueue JS in the customizer controls, you need to use the customize_controls_enqueue_scripts action. This is different than the action used to enqueue scripts into the customizer preview, which is what themes normally do via customize_preview_init or wp_enqueue_scripts. So in your snippet above, replace customize_preview_init with customize_controls_enqueue_scripts. Secondly, in order to extend … Read more
@Nick83, While I’m not trying to make the answer overly complicated, in order to do what you are attempting to do correctly I believe you’ll need to call WordPress via Ajax. My recommendation is the following: Create two ajax calls. The first gets the prices (without duplicates). The second takes whichever price the user chose … Read more
Replace this: $result = $wpdb->get_row(“SELECT * FROM wp44_predefined_address WHERE ‘UPPER(Address1)’ LIKE ‘UPPER(%s)'”, $myinput); with this: (just choose the appropriate $like based on your requirements) // Properly generate the LIKE query. $like=”%” . $wpdb->esc_like( $myinput ) . ‘%’; // e.g. ‘%input%’ //$like=”%” . $wpdb->esc_like( $myinput ); // e.g. ‘%input’ //$like = $wpdb->esc_like( $myinput ) . ‘%’; … Read more
Hi why don’t you used multiple check-box instead of select option field. As well as you have used deprecated functions like “create_function”. I have modified your code which replaced select option with multiple check-box selection. function myCatWidget() { register_widget( ‘my_custom_cat_widget’ ); } add_action( ‘widgets_init’, ‘myCatWidget’ ); class my_custom_cat_widget extends WP_Widget { function __construct() { parent::__construct(‘my_custom_cat_widget’, … Read more
For any poor soul out there that stumbles on the same, niche problem, the answer was frustratingly simple. Instead of trying to reinvent the wheel and build my own query, I should’ve been using the tribe_get_events function that I’m sure the Modern Tribe devs already worked hard to write. Anyway, here’s the final solution for … Read more
The problem is this: selected(get_option(‘lp_actPage’, $slug)) selected needs 2 parameters, but you gave it 1, and get_option wants 1 parameter but you gave it 2. If we reformat this, the problem becomes much clearer: selected( get_option(‘lp_actPage’, $slug) ) What’s necessary is: selected( get_option(‘lp_actPage’) $slug ) Sidenote get_pages doesn’t use the normal post querying code, and … Read more
What are you trying to accomplish? You are assigning the value at the wrong place. It should be: jQuery(function($){ var value = $(“#field-id option:selected”).val(); console.log(value); //And then here use the value });