Add get_option to jquery

Anyway, basically Hody_McGee gave the answer in his comment: You could use wp_localize_script(). As it states in the Codex: [wp_localize_script()] can be used to make any data available to your script that you can normally only get from the server side of WordPress. How do we do this? <?php add_action( ‘wp_enqueue_scripts’, ‘register_scripts’ ); function register_scripts(){ … Read more

How to display a value from a radio button in the options menu in wordpress

Your form is sending data using POST method, so you should receive selected value of radio button in $_POST[‘colorSelect’]. To simply display it you can use: if(isset($_POST[‘colorSelect’])) echo $_POST[‘colorSelect’]; else echo “Nothing selected”; To save it to options table use following code at the start of your function colorSelector(): if(isset($_POST[‘colorSelect’])) update_option(‘colorSelect’, $_POST[‘colorSelect’]); So you can … Read more

Get value of contact form 7 radio button [closed]

Depending when you’d like to take the action you should change the hook – I’ve chosen wpcf7_before_send_mail – your function function wpcf7_cstm_function($contact_form) { $title = $contact_form->title; $submission = WPCF7_Submission::get_instance(); if ($submission) { $posted_data = $submission->get_posted_data(); $txt = isset($posted_data[‘txt’])?$posted_data[‘txt’]:”; $text2 = isset($posted_data[‘txt2’])?$posted_data[‘txt2’]:”; $radio = isset($posted_data[‘radio’][0])?$posted_data[‘radio’][0]:”; // do something with your data } } add_action(“wpcf7_before_send_mail”, “wpcf7_cstm_function”); Explanation: … Read more

radio button is checked but display not check

In the WordPress back-end you have to use checked=”checked” (stricter XHTML), because the CSS will not be applied otherwise: <input type=”radio” name=”colors” id=”blue” checked=”checked”> this is the CSS that applies the blue dot: WordPress already provides a function for this checked() <input type=”radio” name=”colors” id=”blue” <?php checked( ‘red’, get_option( ‘color’ ) ); ?> /> so … Read more

How to add checkbox and radio button in Profile Page

You are missing the “checked” value for the inputs <input type=”checkbox” name=”language” <?php if (get_the_author_meta( ‘language’, $user->ID) == ‘Mandarin’ ) { ?>checked=”checked”<?php }?> value=”Mandarin” /> Mandarin<br /> Also, the usermeta is dealing but your are checking for $_POST[‘gender’] Finally, you should have one usermeta for English and other for Mandarin, as they are not mutually … Read more