New answers tagged

0

HTML <form id="article_form" name="article_form" class="wordpress-ajax-form" method="post" action="<?php echo admin_url('admin-ajax.php'); ?>" enctype="multipart/form-data" > <input type="file" name="uploadedfiles" id="uploadedfiles" accept="image/*" > <br> <input type="hidden" name="action" value="...


1

You can store field values and error messages in session or transient and use them when (re)displaying your form. In your callback action, if data is not valid, save error message and submitted field values. In admin_notices hook check for saved error message. If there is one, show it as error notice. Don't forget to remove saved session/transient value. ...


0

To save a key (buttonID.disabled in this example) to localstorage you can use: localStorage.setItem('buttonID.disabled', 1) To read that key later: localStorage.getItem('buttonID.disabled') Implementing that in your code: jQuery(document).ready(function($) { $("#buttonID").click(function () { setTimeout(function () { disableButton(); ...


0

You can save an item to local storage with one line. Something like this... localStorage.setItem("isDisabled", "true"); Then you can check for the value later by doing something like this... if(localStorage.getItem("isDisabled")===null) { // } Or update the value from true to false ... localStorage.setItem('isDisabled', 'false');


0

This is the way you could handle it, though opinions may vary. Getting the framework up will be a bit complicated and making it pretty is another task entirely. I would make it sexy by running an AJAX query when you submit the form. The AJAX script collects all the data from the boxes on the page, makes the call to the back end, then renders visible a "...


0

Worth having a read of the trac bug here: https://core.trac.wordpress.org/ticket/18322 In short, you can use stripslashes as onetrickpony already mentioned, or wp_unslash, to remove the slashes from your $_POST vars.


-1

Forms submit to the current URL by default. Just leave the action parameter out if you want it to be the current URL. <form method="post" name="newAddress" id="createuser" class="validate" novalidate="novalidate">


1

Just use $_SERVER['REQUEST_URI']; instead of home_url(add_query_arg(array(), $wp->request));


0

Your idea for two custom post types is a good start, but you may wish to consider using taxonomies for the activities and the custom post type for the location. To determine whether the activity needs to be reserved or not could be done by using a custom field and a check on the value with get_post_meta(). That should be enough to get you started.


0

Well, I found a solution for my requirement. I kept the PHP I just posted but added a id to ul-Element. Then I added an html element and Javascript code in same page where PHP-Code is applied. The HTML part I added is as following: <div id="formattedresult" /> <script> var result = document.getElementById('customresult'); document....


0

thank you very much. In the meanwhile I found out how to solve. My current code is as following: class CustomSearch { public function __construct() { add_action('init', array($this, 'init')); add_shortcode('custom_search', array($this, 'shortcode_handler')); } public function init() { if (!empty($_POST['nonce_custom_form'])) { ...


0

Take a look at https://developer.wordpress.org/reference/classes/wpdb/get_col/ On your result page, receive the query as follows <?php if(isset($_POST['name']) || isset($_POST['email'])){ $name = '%' . $wpdb->esc_like( $_POST['name'] ) . '%'; $email = '%' . $wpdb->esc_like( $_POST['email'] ) . '%'; global $wpdb; $prepare = $...


0

Using hidden forms to do all this seems uneccesary, why not just capture the values added to the primary fields? Either way, it's simply a matter of adding the required attribute to each of the fields on the primary form. I'm not sure how you're rendering the primary fields, but doesn't using the * on it work? Would look something like this [text* your-name ...


0

Follow these instructions: Allow Users to Set Password During Registration


Top 50 recent answers are included