New answers tagged forms
0
Step 2. However, when I submit an un-matching password, the form is redisplayed and URL is now http://example.com/wp-login.php?action=resetpass&key=xyz&login=zyx. Notice, that action has changed.
When I attempt this with an invalid key I get redirected to http://example.com/wp-login.php?action=lostpassword&error=invalidkey.
Anyway, the ...
0
Basically what you're looking to do is create a separate page within a WordPress site that (I'm sort of guessing here) you're not creating within WordPress itself, but you want to pull WordPress data.
There's a "cheater" method and an officially sanctioned method to do what you want.
The "cheater" method is to call wp-load.php from your separate PHP file. ...
1
When you load your process.php file directly, it's not within the context of the WordPress environment, so no WordPress functions are available. WordPress has a native AJAX API that should be used for this sort of thing.
First, enqueue your javascript file, then use wp_localize_script to pass the location of admin-ajax.php, which will be processing the ...
0
Per the jQuery noConflict Wrappers section of the wp_enqueue_script() Codex page, the $ variable is not available in WordPress. You can replace $ with jQuery in your jQuery code, or do something like this:
jQuery(document).ready(function($) {
// your code here
.
.
.
});
1
When you get those "headers already sent" messages, it is usually one of several things:
You are echoing something when you shouldn't be, which is any time before get_header on the front end. I can't remember exactly where the window is on the backend.
You are doing something that is triggering a warning or notice that is printing content too soon. Things ...
1
You can add a filter to the editor html
add_filter( 'the_editor', 'add_required_attribute_to_wp_editor', 10, 1 );
function add_required_attribute_to_wp_editor( $editor ) {
$editor = str_replace( '<textarea', '<textarea required="required"', $editor );
return $editor;
}
0
If I understand you right, you want to predefine some variables in an earlier hook/action and use this vars in a later hook/action.
add_action( 'wp', 'predefine_my_vars' );
function predefine_my_vars() {
global $my_vars;
$my_vars = array(
'name' => 'Bob',
);
}
add_action( 'wp_footer' 'show_my_vars' );
function show_my_vars() {
global ...
0
You will need to declare the variable global before using it.
function simple_form(){
global $firstname;
$firstname = 'Bob';
//Do something to populate the form field name <fname> with "Bob"
}
Your form should be able to do ...
global $firstname;
echo $firstname;
... to use the variable.
However, I can't help but think there is a ...
2
What would be the easiest, cheapest approach for this?
Simple, create one form per language.
In functions.php or, preferably, as a custom plugin:
add_shortcode( 'my-lingo-form', 'shortcode_wpse_98360');
function shortcode_wpse_98360()
{
$lingo = your_language_detection_method();
switch( $lingo )
{
case 'en':
echo ...
1
I suggest you use <input type="submit" /> or <button type="submit" />.
<input type="button" /> is valid but doesn't submit the form by default (without you adding any ajax/js magic to it.
0
In the first step: I think your theme misses wp_head() and/or wp_footer(). This means the cf7 is not able to load the Javascript for the 'pretty' ajax form submit.
If you checked that you have wp_head and wp_footer in your themes header.php and footer.php you can find additional suggestions for getting it working here: ...
0
Plugin should never rely on a specific markup for the form. The only part that can be implied is the name of the search field: s. I don’t think any good plugin would break if you use a button.
I have written themes without any submit button; and nothing was broken.
1
You can do this by means of jQuery (which means this is rather a jQuery/JavaScript question).
Put the following in one of your (already included) JS files, or create a new JS file and enqueue it, or hard-code it in between <script>...</script> tags:
jQuery(document).ready(function($) {
$('#my-form-field').attr('placeholder', 'Please enter ...
1
Instead of …
} else {
echo "<p>Your file has been uploaded.</p>";
}
… redirect to another address on success:
} else {
$new_url = add_query_arg( 'success', 1, get_permalink() );
wp_redirect( $new_url, 303 );
}
Status code 303 triggers a GET request:
This method exists primarily to allow the output of a POST-activated script ...
Top 50 recent answers are included
