Input with pattern not working

Most likely because widgets are saved via AJAX, and, as far as I’m aware, the submit handler will bypass any HTML5 input rules unless they are explicitly checked with JavaScript. Your best bet is to validate/sanitize the data server-side, and pass back any messages if there is an input error. Chrome adding =”” is just … Read more

WP Page Options Array

After much experimentation I resolved my own question and this answer might help somebody. function mmm_select_field( ) { $options = get_option( ‘mmm_settings’ ); $buttons = array( ‘Bold’ => ‘bold’, ‘Italic’ => ‘italic’, ‘Underline’ => ‘underline’, ‘Superscript’ => ‘superscript’, ‘Align Left’ => ‘alignleft’, ‘Align Center’ => ‘aligncenter’, ‘Align Right’ => ‘alignright’, ‘Bullet List’ => ‘bulletlist’, ‘Number … Read more

How to add a placeholder to the protected post password input

This can be achieved via a hook, called the_password_form: function my_theme_password_placeholder($output) { $placeholder=”Hello!”; $search=”type=”password””; return str_replace($search, $search . ” placeholder=\”$placeholder\””, $output); } add_filter(‘the_password_form’, ‘my_theme_password_placeholder’); A str_replace searches for the string type=”password” inside the output. This gives an attribute to the <input> indicating it’s of type password. The replacement string contains the searched one plus the … Read more

get value from selected input

Well, I don’t know how many input type of radios and checkboxes you have, but this should get you want you need: $(document).ready(function() { $(‘input:radio’).change(function() { // get the value var newValue = $(this).val(); // Update the div.score $(‘div.score’).text(newValue); }); }); PS: Your radio input need to have the same name, if you do not … Read more

Use of http form post

Honestly, your best bet is to actually use $_POST to process this logic. In your form, your submit buttons lack a name attribute which would allow you to do this: <form method=”post” action=”http://xxx.yyy/wp-admin/admin-post.php”> <td width=”60″ height=”26″> <input type=”submit” value=”Lot #” name=”lot”> </td> <td width=”154″ > <input type=”submit” value=”Name” name=”name”> </td> <td width=”154″> <input type=”submit” value=”Subdivision … Read more

Frontend Category Checkbox

Your select tag doesn’t have a name attribute, it only has a type and value. The name is used as an ID when you POST most likely the reason your data isn’t saving. Quick Example: <form action=”/action_page.php”> <select name=”cars”> <option value=”volvo”>Volvo XC90</option> <option value=”saab”>Saab 95</option> <option value=”mercedes”>Mercedes SLK</option> <option value=”audi”>Audi TT</option> </select> <input type=”submit” value=”Submit”> … Read more

How to add “on change” to a text input in contact form7?

The CF7 plugin does not give you access to the HTML markup formatting function of the field tags. So you need to capture the JavaScript event fired when the field is changed. To do this you can tag a script at the end of your form, <label>[text* name id:name]</label> <label>[text* surname id:surname]</label> [submit] <script> (function($){ … Read more

I am trying to make a page in the admin section similar to the appearance of the Profile page for users

If I understand you correctly you want to create a page for your plugin which mimics the look and feel of the WordPress Dashboard and it’s option pages? If so then you can use the CSS which is packed with WordPress. The CSS file is located at wp-admin/wp-admin.css If you open that file with your … Read more

Remember form field values with page navigation

Use sessions <?php session_start(); // your fomrfields $post_fields = array( ‘key_one’, ‘key_two’, ‘key_three’ ); $form_data = array(); // copy needed form data from $_POST array foreach ( $post_fields as $key ) if ( isset( $_POST[$key] ) $form_data[$key] = $_POST[$key]; // save your form data in a session if no form data was saved before if … Read more

Save and user submitted data from a form and display them in the wp backend

Can you just tell me how I can grab the input value for “name” and add the entry to custom_post_type? Sure thing: if ( isset( $_POST[‘name’] ) ) { $name = sanitize_text_field( wp_unslash( $_POST[‘name’] ) ); if ( $name ) { wp_insert_post( array( ‘post_title’ => $name, ‘post_type’ => ‘my_post_type’, ‘post_status’ => ‘publish’, /* Or “draft”, … Read more