• Vess
    March 19, 2015 at 9:27 am #104658

    Hello

    I have changed the below code for WP RESIDENCE file property_categories.php from dropdown single select to multiple selection, but now it is not submitting and receiving any values from front end.
    Please give a solution.

    <?php
    /**
    * echo off.
    * changed name (adding “[]”)
    */
    $args = array(
    ‘class’ => ‘select-submit2′,
    ‘hide_empty’ => false,
    ‘selected’ => $prop_action_category_selected,
    ‘name’ => ‘prop_action_category[]’,
    ‘id’ => ‘prop_action_category_submit’,
    ‘orderby’ => ‘NAME’,
    ‘order’ => ‘ASC’,
    ‘show_option_none’ => __(‘None’,’wpestate’),
    ‘taxonomy’ => ‘property_action_category’,
    ‘hierarchical’=> true,
    ‘echo’ => 0,
    );

    /** get the dropdown **/
    $dropdown = wp_dropdown_categories( $args );

    /** insert “multiple” using str_replace **/
    $multi = str_replace( ‘<select’, ‘<select multiple ‘, $dropdown );

    /** output result **/
    echo $multi;?>

    • This topic was modified 1 year, 10 months ago by  Vess.
    • This topic was modified 1 year, 10 months ago by  Vess.
    mithril
    July 17, 2015 at 9:21 am #115639

    Hello,

    Did you get the code to work? I’m having the same issue.

    Vess
    July 20, 2015 at 9:04 am #116167

    I am on the same stage, as written above.

    Anna
    July 31, 2015 at 1:10 pm #117866

    By adding multiple you allow only for multiple selects on that particular select. But that does not mean it is saved into database with multiple values, or is interpreted as multiple values in the same page.

    The code is not working probably because the post variable is now an Array and you need to save it like one. Then you need to check every category and see if is inside the array you just saved and marked as selected. In the same page you should do a print of the variable and see if it saved correctly.

    It’s possible this development link will help with more technical steps: http://wordpress.stackexchange.com/questions/170316/multiple-checkboxes-metabox

    Vess
    July 31, 2015 at 4:34 pm #117903

    Thank you Anna for the hint.

You must be logged in to reply to this topic.

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.