WordPress taxonomy radio buttons

I am trying to change the checkboxes for the terms on the backend to radiobuttons. I found this topic: Altering the appearance of custom taxonomy inputs however wich helped me doing this. However, this will turn ALL terms checkboxes to radio buttons. Is it possible to apply this only for one taxonomy? My code: add_action('add_meta_boxes','mysite_add_meta_boxes',10,2); function mysite_add_meta_boxes($post_type, $post) { ob_start(); } add_action('dbx_post_sidebar','mysite_dbx_post_sidebar'); function mysite_dbx_post_sidebar() { $html = ob_get_clean(); $html = str_replace('"checkbox"','"radio"',$html); echo $html; } thanks
Category: Web

Gutenberg RadioControl saving data but not not selecting radio

The RadioControl attribute below saves data but the selected radio isn’t checked. I think the state isn’t being updated, or I’m using the wrong value in the selected attribute. I reviewed the documentation, https://developer.wordpress.org/block-editor/components/radio-control and the Lynda series https://www.lynda.com/WordPress-tutorials/WordPress-Developing-Blocks-Gutenberg/5034179-2.html In the code below, the component is isolated below from the rest of the block. import { registerBlockType } from '@wordpress/blocks'; import { RadioControl } from '@wordpress/components'; // Import our CSS files import './style.scss'; import './editor.scss'; registerBlockType( 'dynamic-equine/radio', { title: 'DE …
Category: Web

Setting a menu link to open a pop-up

I want to set an menu item to work exact like the following link <a onclick="window.open('/projects/aio-radio/demo/', 'aio_radio_player', 'width=720, height=355'); return false;" href="#" class="btn btn-success"><i class="fa fa-external-link"></i> Radio Player </a> There's only basic features like adding a class and open on a new window on wordpress menu options.
Category: Web

Desktop is class List and Mobile is class Grid

<input type="radio" class="list" checked> <!-- checked, desktop --> <input type="radio" class="grid"> <!-- checked, mobile --> Here class list is desktop and mobile. I know it is css media screen. How can I change the mobile is class grid and desktop is class list? Now it is only list on the first, both desktop and mobile.
Category: Web

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

I'm a little stumped on this one. I'm not very experienced when it comes to PHP, but I have figured out how to display a value inputted from a text box. I'm now trying to do the same with a radio button. My ultimate goal is to allow the site admin to be able to change the color of the theme by selecting from a few options. I want to be able to change CSS depending on what option is …
Category: Web

Colour of selected radio button seems backwards in Twenty Seventeen + Woocommerce

Help for a novice? I want to use the dark colour choice of Twenty Seventeen with Woocommerce. When I do so, the radio buttons on the "Checkout" page used to choose a payment method seem to be the wrong colour: The selected radio button is black and the unselected radio button is white. On a dark background, the white button seems to be the selected one, which is quite confusing to the visitors. How can I change this? I'm not …
Category: Web

radio button is checked but display not check

im trying to save different value of radio buttons on same name, it works and was able to make checked appear if the correct value is saved. As you can see on the screenshot ABOVE (which is taken on view-source:), it the correct selected input is CHECKED already however even if it's check you can see on the screenshow BELOW that it doesn't display as checked. It's already checked but not displaying , i dont know
Category: Web

Check radio get value to array

i have input radio as: <input type="radio" name="payvalue" value="126500000"><br> <input type="radio" name="payvalue" value="252000000"><br> <input type="radio" name="payvalue" value="503000000" checked><br> and a href get value to payment as <a target="_blank" href="https://www.demo.com/[email protected]&price=GET_VALUE_OF_RADIO">Pay Now</a> How to change input radio get value of check to price=GET_VALUE_OF_RADIO Any idea for hepls me. Thanks
Category: Web

Foreach loop not working as expected - custom tables and references while submitting a form

I have two custom tables and i would like to have a form submission with the name of the redskabs tables to make an reference to my registreringer table. But im confused to how foreach is working in this example. CREATE TABLE $table_registreringer ( reg_id INT UNSIGNED NOT NULL AUTO_INCREMENT, dato TIMESTAMP DEFAULT CURRENT_TIMESTAMP, billedeURL VARCHAR(80) NOT NULL, fiske_vaegt INT NOT NULL, fiske_laengde INT NOT NULL, reg_user_id BIGINT UNSIGNED NOT NULL, reg_redskabs_id INT UNSIGNED NOT NULL, PRIMARY KEY (reg_id), FOREIGN …
Category: Web

Change default "Apply Changes To" radio option when editing images

I have a theme where when the user edits images, I want the changes to apply to "all sizes except for thumbnails". She remembers to check this box most of the time, but not always, and it is very aesthetically unappealing on one page when she doesn't. Also; it's kind of a pain for here to have to check the box every time. I found in /wp-admin/includes/image-edit.php where the default is set -> happens on line 133 with: <input type="radio" …
Category: Web

Get value of contact form 7 radio button

I have following radio buttons in contact form 7 and a few text fields and hidden fields. [radio radio id:radio label_first "3" "6" "9" "12"] Following are a few example lines of code in functions.php. I am able to get all the other values e.g text fields and hidden fields but not radio buttons. function wpcf7_cstm_function($contact_form) { $title = $contact_form->title; $submission = WPCF7_Submission::get_instance(); if ($submission) { $posted_data = $submission->get_posted_data(); } $txt = $posted_data['txt']; $text2 = $posted_data['txt2']; $radio=$posted_data['radio']; } Is there …
Category: Web

Required radio button does not validate in form, when clicked through Javascript/jQuery

I have a radio button that selects a dealer in my checkout. I need this button to automatically be checked for the user - however, no matter what I do, the radio button still needs to be clicked to validate. Here's what I've tried so far: document.getElementById("#dealer-selection-" + elm.id).click(); This makes the radio button show up as if it's been clicked, however when submitting form, a notice still pops up with a validation error. jQuery('.forhandlerRadio:first').attr('checked', 'checked'); Same thing as above …
Category: Web

theme customizer - can a single option pass multiple values?

In my customizer panel I have a radio button for hiding or showing a feature on my WordPress site. However I need to pass multiple values when a single option is selected. e.g. the related sections in my functions.php looks like this: $wp_customize-> add_control('blog_setting', array( 'label' => __("Turn on / off the blog link", 'portfolio'), 'section' => 'Layout_options', 'settings' => 'blog_setting', 'type' => 'radio', 'choices' => array( 'block' => 'Blog link visible', 'none' => 'Blog link hidden' ) ) ); …
Category: Web

How to use radio buttons in WordPress plugin options using register settings?

How do I get this to save the radio buttons? It saves the checkboxes but I've tried a lot of methods and can't get it to save the radial buttons. Any help will be appreciated. Working Plugin Example just drop into wp-content/plugins/myplug folder. <?php /* Plugin Name: myplug Version: 0.1 Plugin URI: http://myplug.org Author: ME Description: Stupid plugin */ add_action('admin_init', 'myplug_register_options'); // register options for the form add_action('admin_menu', 'myplug_admin_links'); // register admin menu hyperlinks /** Function to register form fields …
Category: Web

Using radio button meta data from a custom meta box

Very new to attempting PHP and am hacking together my first plugin using tutorials.. I have a custom meta box with a Yes/No radio button on all WordPress pages (in the editor). EDIT- I removed the original code. See below. So.. my question is, how do I check to see which of the two buttons is checked using an if() statement? I plan on appending a script to WordPress pages that have 'yes' selected. I'm simply not sure which value …
Category: Web

Click a radio button must set textfield value

I have these radio-buttons in my checkout page: <input id="95292" type="radio" name="GLSShop" value="95292" onclick="SaveShopID('95292')"> <input id="95064" type="radio" name="GLSShop" value="95064" onclick="SaveShopID('95064')"> <input id="95403" type="radio" name="GLSShop" value="95403" onclick="SaveShopID('95403')"> When user click e.g. button no. 2 I want the value of a textfield to be set to '95064' I was thinking about making a java- or jqueryscript something like this: function SaveShopID($ShopID){ $("#order_comments").val($ShopID); }; 1: Would this be the best and easiest way of doing it? 2: If so, how would the script …
Category: Web

show/hide div with simple jQuery script

I want to show/hide contents by using radio buttons on a WordPress page. When a user clicks on the radio button with label "red", the corresponding div with the class "red" needs to show up. Here's the (working) example I'm trying to integrate: http://www.tutorialrepublic.com/codelab.php?topic=faq&file=jquery-show-hide-div-using-radio-button In WordPress, I've placed this in the custom CSS of my theme: .box { padding: 20px; display: none; margin-top: 20px; border: 1px solid #000; } .red { background: #ff0000; } .green { background: #00ff00; } .blue …
Category: Web

Add get_option to jquery

I have created a settings page that contains various radio button options for a custom plugin. A radio button I've created is to 'display dots' with the values yes or no. I can get use the value any other time except in the jQuery function below. I would like to get the value of the option to use for 'dots' in the jQuery function below. jQuery script <script type="text/javascript"> jQuery(document).ready(function(){ jQuery('.single-item').slick({ arrows: true, dots: ***OPTION VALUE HERE (true or false)*** …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.