Adding drop down via functions.php - wordpress

Discussion in 'PHP' started by bellcom, Mar 2, 2014.

  1. #1
    Wasn't sure if this should be in the wordpress section instead.... but I am using the PaidMembershipsPro free version plugin so don't get free support.

    When signing up I wanted to add a few extra fields and found the code on github to add to the functions.php for adding input fields which works fine.
    https://gist.github.com/strangerstudios/1389944

    However, I wasn't sure how to add a select/drop down instead of input field.
    I know I would have to update other parts of the script, but just to display the drop down correctly, could someone tell me how to replace the following with a drop down with say 2 or 3 selections?

    <div>
    <label for="firstname">First Name</label>
    <input id="firstname" name="firstname" type="text" class="input" size="30" value="<?=esc_attr($firstname)?>" />
    </div>

    Maybe replace with a simple drop down:
    <label for="gender">Select Gender</label>
    <select name="gender" id="gender">
    <option value="male">male</option>
    <option value="female">female</option>
    </select>

    Wasn't sure where or how to add this from the first example:
    value="<?=esc_attr($firstname)?>"

    thanks!!
     
    bellcom, Mar 2, 2014 IP