Best way to create multi-step form with data saved to user account for later updating?

If you are working on a custom theme, I believe it is easier to be done with a page template and WordPress’s wp_ajax function. The form can be included in the page using <?php get_template_part(‘form’,’0f-50-question’) ?>. Here is the pseudo code for the form <form id=”quite-a-long-form” action=”<?php echo admin_url(‘admin-ajax.php’); ?>” method=”post” class=”form” > $step = … Read more

How to Validate Widget Input

If you are using the Widget API then declare your widget as a class which extends WP_Widget class and there you can define an upadte function where you can do your validation, the codex as a nice example of doing just that.

Gravity Forms Custom Templates [closed]

You can change a bunch in one hit with the gform_address_types filter, like this: /** * customise the Address field labels * @param array $addressTypes * @return array */ add_filter(‘gform_address_types’, function ($addressTypes) { $addressTypes[‘international’][‘zip_label’] = ‘Postcode’; $addressTypes[‘international’][‘state_label’] = ‘State’; return $addressTypes; });

Add new user : make the fields First Name and Last name required

If you were looking to make the fields required in the WordPress admin form for adding new user as i understood from your question, where the output is not filterable, you could basically do what you described (adding form-required) on browser side function se372358_add_required_to_first_name_last_name(string $type) { if ( ‘add-new-user’ === $type ) { ?> <script … Read more

using update_user_meta in form to set and get custom meta

You need to pull your meta_data from WP and fill that info into the form… like so: function my_form_function() { global $current_user; $low_price = get_user_meta( $current_user->ID, ‘_low_price’, true); $medium_price = get_user_meta( $current_user->ID, ‘_medium_price’, true); $high_price = get_user_meta( $current_user->ID, ‘_high_price’, true); ?> <form name=”setPrices” action=”” method=”POST”> <fieldset> <label for=”lowPrice”>Value 3:</label> <input type=”text” id=”lowPrice” name=”lowPrice” value=”<?php echo … Read more

Metabox repeating fields – radio buttons not saving correctly

So I came back to this after practice and implemented some of the Alchemy setup, meaning all the inputs have names like name=”_movies[3]Metabox repeating fields – radio buttons not saving correctly” where 3 is the iteration we’re on in the loop. Create the Metabox // metaboxes should be registered on the add_meta_boxes hook add_action(‘add_meta_boxes’, ‘add_meta_boxes’ … Read more

Success message in comment form

Without Ajax or plugins. Add to function.php: add_action( ‘set_comment_cookies’, function( $comment, $user ) { setcookie( ‘ta_comment_wait_approval’, ‘1’ ); }, 10, 2 ); add_action( ‘init’, function() { if( $_COOKIE[‘ta_comment_wait_approval’] === ‘1’ ) { setcookie( ‘ta_comment_wait_approval’, null, time() – 3600, “https://wordpress.stackexchange.com/” ); add_action( ‘comment_form_before’, function() { echo “<p id=’wait_approval’ style=”padding-top: 40px;”><strong>Your comment has been sent successfully.</strong></p>”; }); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)