I created Customized Consumer Fields on a Consumer Profile Utilizing this tutorial.
How do I add a discipline on the Customers profile? For instance, nation, age and so forth.
I created three customized fields with the names:
“ID”,”Message”, “Kilometers” on my WordPress web site on the Consumer -> Profile Tab,
like so:
The code in my Theme File Editor in my WordPress web page for these three fields(Theme Features – capabilities.php) seems to be like this:
add_action( 'show_user_profile', 'extra_user_profile_fields' );
add_action( 'edit_user_profile', 'extra_user_profile_fields' );
operate extra_user_profile_fields( $consumer ) { ?>
<h3><?php _e("Additional profile info", "clean"); ?></h3>
<desk class="form-table">
<tr>
<th><label for="tackle"><?php _e("ID"); ?></label></th>
<td>
<enter sort="textual content" title="tackle" id="tackle" worth="<?php echo esc_attr( get_the_author_meta( 'tackle', $user->ID ) ); ?>" class="regular-text" /><br />
<span class="description"><?php _e("Please enter your ID."); ?></span>
</td>
</tr>
<tr>
<th><label for="metropolis"><?php _e("Message"); ?></label></th>
<td>
<enter sort="textual content" title="metropolis" id="metropolis" worth="<?php echo esc_attr( get_the_author_meta( 'metropolis', $user->ID ) ); ?>" class="regular-text" /><br />
<span class="description"><?php _e("Please enter your message."); ?></span>
</td>
</tr>
<tr>
<th><label for="province"><?php _e("Kilometers"); ?></label></th>
<td>
<enter sort="textual content" title="province" id="province" worth="<?php echo esc_attr( get_the_author_meta( 'province', $user->ID ) ); ?>" class="regular-text" /><br />
<span class="description"><?php _e("Please enter your kilometers."); ?></span>
</td>
</tr>
<tr>
</tr>
</desk>
<?php }
add_action( 'personal_options_update', 'save_extra_user_profile_fields' );
add_action( 'edit_user_profile_update', 'save_extra_user_profile_fields' );
operate save_extra_user_profile_fields( $user_id ) {
if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'update-user_' . $user_id ) ) {
return;
}
if ( !current_user_can( 'edit_user', $user_id ) ) {
return false;
}
update_user_meta( $user_id, 'tackle', $_POST['address'] );
update_user_meta( $user_id, 'metropolis', $_POST['city'] );
update_user_meta( $user_id, 'postalcode', $_POST['postalcode'] );
}
I wish to show the output from these fields on a consumer customized consumer web page.
So for instance I’m saving the output from these three customized fields and I enter my WordPress web site I select a customized consumer web page and I would really like the output from these three fields to look there. Ideally I wish to show the output in a desk but when that is not attainable I’m open to any resolution actually.
Many Thanks!