Plugin development: how to create a form and get custom data?

The details of processing form data is specific to PHP therefore I will not go into it. The WordPress-specific part is that you want your code to be run on the ‘init’ event in order to have access to WordPress functions and globals (such as the users permissions). <?php add_action(‘init’, function(){ $reservation_capacity = sanitize_text_field( $_POST[‘reservation_capacity’] … Read more

Pagination not working for Custom search form & custom result template

i’ve seen this: next_posts_link You must use wp_reset_postdata when use new WP_QUERY(), and this <div class=”pagination” id=”blog-pagination”> <span class=”previous” ><?php previous_posts_link( ‘&larr;Newer’, $loop->max_num_pages ); ?></span> <span class=”next”><?php next_posts_link( ‘Older &rarr;’, $loop->max_num_pages ); ?></span> </div> go into if($loop->have_posts()):?> condition

Handling error states with admin_post

You can use set_transient with the user_id if you are relying on users being logged in, otherwise, cookie would probably be better. For logged in users, you can have the user_id get set within the name of the transient. An example here: function form_post() { $user_info = wp_get_current_user(); $user_id = $user_info->exists() && !empty($user_info->ID) ? $user_info->ID … Read more

show image in mail contact form 7 [closed]

As per my comments, it seems you are trying to attach images to emails rather than ‘show’ them. Since you have [file* image filetypes:jpg|png|gif] what you need to do is put [image] in the ‘File Attachments’ box in the Contact Form 7 settings. This is from the Contact Form 7 File Uploading and Attachment doc.

what is the meaning of settings_fields()

Via the Developer Reference (not the Codex) Output nonce, action, and option_page fields for a settings page. Here’s the source code for it function settings_fields($option_group) { echo “<input type=”hidden” name=”option_page” value=”” . esc_attr($option_group) . “” />”; echo ‘<input type=”hidden” name=”action” value=”update” />’; wp_nonce_field(“$option_group-options”); } so, it gives the form processor some info to work with … Read more

How to link WordPress heartbeat to ajax form

Saving data Based on Heartbeat API, you can add custom data to the sent heartbeat on heartbeat-send event in js. This would be used instead of the ajax function you have in your code example. jQuery( document ).on( ‘heartbeat-send’, function ( event, data ) { // Grab the required form data data.location = jQuery(‘input[name=”location”]:checked’).val(); data.userid … Read more

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