Setting a menu link to open a pop-up
Setting a menu link to open a pop-up
Setting a menu link to open a pop-up
In the code you posted there are some errors, that maybe are only typos, in general the name of your inputs do not match with the name of the related setting. When you save your settings as array, name must be always in the form array_name[‘option_name’] but for radios you don’t follow this rule (but … Read more
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
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
$response_radio = $_POST[‘meta-radio’]; if ($response_radio==”radio-one”) { //do your stuff } elseif ($response_radio==”radio-two”) { //do other stuff } I think this is what you are looking for
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
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
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
However, this will turn ALL terms checkboxes to radio buttons. Not only that, it’ll turn any checkbox in a meta box – not ideal! Instead, let’s specifically target the wp_terms_checklist() function, which is used to generate the list of checkboxes across the admin (including quick edit). /** * Use radio inputs instead of checkboxes for … Read more