Tag Info

New answers tagged

0

Just remove type="submit" from your button and let your jQuery ajax call be triggered first. Once you get the response then you can submit your form as well. Something like this; function your_action_javascript() { ?> <script type="text/javascript" > jQuery(document).ready(function($) { $('.button').on('click', function () { ...


1

The context of your code that fails isn't entirely clear, but it's failing because get_the_ID() won't return a post ID when run on the init hook, because the main query hasn't been executed yet. If you have a look at the Action Reference, wp is the earliest action where you can access the current query's data, if your code is operating on the currently ...


1

Hook your form processing code to an action that runs before the page is rendered and no redirect will be necessary. function wpd_check_submission(){ if( isset( $_POST['start'] ) ) { // do your post insertion here } } add_action( 'init', 'wpd_check_submission' );


-1

You have to add jquery.form.min.js it work for me , Hope it works for you.


0

The issue I worked out was that I'd previously built another form on my staging site using CCF, I went through phpmyadmin posts and deleted everything ccf-based then rebuilt my form and since there were no previous forms this form was assigned the id 122 and my template now works :) It would still be good to know if there's a way to search for wildcards ...


0

Your best option is to buy the Gravity Forms plugin in order to accomplish this. http://www.gravityforms.com/ Yes, there are other form plugin options such as Contact Form 7 but I can assure you (and everyone here) that the Gravity Forms plugin is hands down the option for this task.


0

If you're refering to WP internal forms: Wordpress has an built in security mechanism called "wp nonces" (https://codex.wordpress.org/WordPress_Nonces) - that's an unique hash generated for every WP-form. Every Backend code should check for the according nonce to make sure that The form submission wasn't done from outside (usually attacks or bots) The ...


0

You can't. If you're using the settings API correctly, here's what happens when you try to save your options: Form posts to options.php WordPress handles $_POST and runs update_option on your registered settings Your sanitize callback from register_setting is applied Any data that fails/you don't return in your callback isn't saved WordPress redirects ...


0

Like the previous answer, you can store the GCLID in a session. Google has a tutorial here, just go to the "enable your website and lead tracking system" section for the code - https://support.google.com/adwords/answer/2998031?hl=en


0

After trying a few more ideas I found the one that did the trick. So if anyone else is looking for something similar, here's what worked for me: $(function() { $('.checkbox').click(function() { if ($(':checked', this).length > 0) { $(this).addClass('selected'); } else { $(this).removeClass('selected'); ...


0

If you're releasing this as a plugin, you absolutely must use the AJAX API. It's super easy: /** * Handle the request and return the result. */ function alumni_process_request() { global $wpdb; // All your processing code from your original question, except for loading WordPress! return $data; } /** * AJAX handler for the "alumni" action. ...


2

The "Skip to toolbar" in the WP Navbar comes tabindex attribute set to 1; I really think it is correct because it is the first visual element when the navbar is active. The problem is that the HTML of the navbar isn't really the first in the source code, it is in the footer, so your form fields are first in the source code. When two elements has the same ...


0

UPDATE: Call forms into front-end: <?php if (!is_user_logged_in()) { get_template_part('header', 'form'); } else { get_template_part('header', 'panel'); } ?> header-form.php content: <div class="alert alert-dismissible fade in" role="alert"> <button type="button" class="close" data-dismiss="alert" aria-label="Close" ...


0

This is pretty easy out of the box: Just use the [_url] special mail tag. As long as you are on a post or page you can even add some more things like the title with [_post_title]. Just have a look at the documentation for more options.


0

You can try to add a get parameter to your url in the link to your contact form. If it's a lightbox style, you can also define a hidden field and fill it when wpcf7 loads up using global $post. Use this code for the url parameter solution and replace id_post by global $post->ID for the lightbow solution : //Add the post id function add_post_id_origin ( ...



Top 50 recent answers are included