Instead of text I need to display image. User will choose Male or Female from drop down list in the user profile and the image of my choice (different for female and different for male) will display on front end. Right now on front-end it displays text "Female" or "Male". How to modify it?
add_action( 'show_user_profile', 'custom_user_fields' ); add_action( 'edit_user_profile', 'custom_user_fields' ); add_action( "user_new_form", "custom_user_fields" ); function custom_user_fields( $user ) { $user_fb_link = get_the_author_meta( 'user_fb_link', $user->ID); $user_gender = get_the_author_meta( 'user_gender', $user->ID); ?> <h3><?php _e("Custom User information", "blank"); ?></h3> <table class="form-table">
<tr>
<th>
<label for="user_gender"><?php _e("Gender"); ?></label>
</th>
<td>
<select name="user_gender" id="user_gender" style="width:180px">
<option value="">-Select Gender-</option>
<option value="male" <?php selected( $user_gender, "male"); ?>>Male</option>
<option value="female" <?php selected( $user_gender, "female"); ?>>Female</option>
</select>
</td>
</tr>
<tr>
<th>
<label for="user_fb_link"><?php _e("Enter Your Fb Link"); ?></label>
</th>
<td>
<input type="text" name="user_fb_link" id="user_fb_link" size="60" value="<?php echo $user_fb_link;?>" />
</td>
</tr>
</table> <?php } add_action( 'personal_options_update', 'save_custom_user_fields' ); add_action( 'edit_user_profile_update', 'save_custom_user_fields' ); add_action( 'user_register', 'save_custom_user_fields' ); function save_custom_user_fields( $user_id ) { if ( !current_user_can( 'edit_user', $user_id ) ) { return false; } update_user_meta( $user_id, 'user_gender', $_POST['user_gender'] ); update_user_meta( $user_id, 'user_fb_link', $_POST['user_fb_link'] ); }