wordpress not displaying my form

This is correct behaviour. A simple echo will just return the field from the DB, unmodified. if you want to render the shortcode try <div class=”first”><?php $recentProjects = get_post(‘275’); echo do_shortcode($recentProjects->post_content); ?> </div>

Creating a custom multilingual form

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 do_shortcode(‘[form-en]’); break; default: echo do_shortcode(‘[form-other-languages]’); break; } } In your post or page: [my-lingo-form].

limit characters when posting from form

To limit characters add this to your textarea: maxlength=”200″ changing “200” to whatever you want the character limit to be. <textarea id=”description” maxlength=”200″ tabindex=”3″ name=”description2″ cols=”50″ rows=”6″></textarea> For a character counter you will need some basic Javascript, something like this: counter = function() { var value = $(‘#description’).val(); if (value.length == 0) { $(‘#totalChars’).html(0); return; … Read more

How to know what submit button the user clicked?

The submit_button() function is a wrapper for get_submit_button(). Now that function has multiple arguments, but the most interesting for your actual problem is the 3rd argument name. It sets the HTML name attribute. <form action=””> <input … etc. <button type=”submit” name=”choice-a”> </form> Now everytime you process your form with an empty action attribute, you will … Read more

How to implement post/redirect/get pattern on contact form

You could use the admin_post URL and actions to process form input and then redirect back to your page. The form: <form action=”<?php echo admin_url(‘admin-post.php’); ?>” method=”post”> <input type=”hidden” name=”action” value=”do_something”> <input type=”hidden” name=”origin” value=”<?php the_ID(); ?>”> <input type=”submit” value=”Submit”> </form> Then the action: add_action( ‘admin_post_do_something’, ‘wpd_do_something’ ); add_action( ‘admin_post_nopriv_do_something’, ‘wpd_do_something’ ); function wpd_do_something() { … Read more

creating form for wp_remote_post

You could make the form action be the current page’s URL. When the user submits the form the page gets reloaded with the POST parameters. Then in your widget’s code you check if those parameters exist. If so, you check them and then process them with your wp_remote_post. Personally I use Gravity Forms for stuff … Read more

Customize reset password form redirect problem

You can add the following to your functions.php to achieve what you are after. The action init doesn’t seem to fire in time for what you are looking for. if($_GET[‘action’]===’rp’ && strpos($_SERVER[‘REQUEST_URI’],’wp-login.php’)) { $key = isset( $_GET[‘key’] ) ? $_GET[‘key’] : ”; $login = isset( $_GET[‘login’] ) ? $_GET[‘login’] : ”; wp_redirect( site_url( ‘/reset-password/’ ) … Read more

Saving checkbox/option list status?

This is really just an html question, not specific to WordPress. Look into checked=”checked” (for check boxes) or selected=”selected” (for selects, radio buttons, etc.) In your case, <input type=”checkbox” name=”showS” value=”true” <?php if (get_option(‘showS’)==true) echo ‘checked=”checked” ‘; ?>> Since this is WordPress, though, I should also be reminding you to use the Settings API where … Read more

Return to option page after running PHP script

You said your original code is working. I think you should try using wp_redirect but you can’t output any HTML/Headers for that. Untested, but try the following: Note: intentionally missed out the html/body tags… <?php require_once(‘../../../wp-config.php’); require_once(‘../../../wp-load.php’); global $wpdb; $feedurl=$_POST[‘scimp_feed_url’]; $showcategory=$_POST[‘scimp_show_category’]; $table_name = $wpdb->prefix . ‘scimp’; $wpdb->insert( $table_name, array(‘feedurl’ => $feedurl, ‘category’ => $showcategory)); wp_redirect( … Read more