Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 885477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:55:08+00:00 2026-05-15T12:55:08+00:00

How can I add a radio button in my wordpress widget form? I have

  • 0

How can I add a radio button in my wordpress widget form? I have been able to add input fields that gets saved and works fine. But I am having trouble with radiobuttons. Anyone?

This is my code for input field:

<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php _e('Video ID:'); ?> 
    <input class="widefat" id="<?php echo $this->get_field_id('id');  ?>" 
    name="<?php echo $this->get_field_name('id'); ?>" 
    type="text" value="<?php echo $id; ?>" /></label></p>

and this is my radio button

<input type="radio" name="video_size" value="small"> Small<br>
    <input type="radio" name="video_size" value="full" checked> Full 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:55:08+00:00Added an answer on May 15, 2026 at 12:55 pm

    Create each radio button and make sure they are under the same “group”. The following is a basic HTML version of what you want.

    <input type="radio" name="group1" value="small" checked>Small<br />
    <input type="radio" name="group1" value="full"> Full<br />
    

    Take note of the name="group1" — this groups the two selections together so you can choose one or the other. checked marks the default selection when the radio buttons load.

    The WordPress version of this will require some logic to check what select the user has made. You will need to check if small or full is selected and have it supplement the checked attribute accordingly.

    For instance

    if($size == 'Full')
    {
         echo '<input type="radio" name="group1" value="small">Small<br />' . "\n";
         echo '<input type="radio" name="group1" value="full" checked> Full<br />' . "\n";
         //This will out put the radio buttons with Full chosen if the user selected it previously.
    }
    else
    {
         echo '<input type="radio" name="group1" value="small" checked>Small<br />' . "\n";
         echo '<input type="radio" name="group1" value="full"> Full<br />' . "\n";
         //This will out put the radio buttons with Small selected as default/user selected.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to add radio buttons in my iPhone application. For that I have
I want to dynamically add a radio button on a form, using VBA. I
how to add image in radio button. Image can be change melodramatically.
In this page there's a way to dynamic add html (textbox,input button and radio
if radio button 2 is checked add input box into datesettings. How do i
I know that I can add a HintPath to an external DLLs to help
Extension method is a really helpful feature that you can add a lot of
I have a button that will create a new entry (row in a table)
I want the functionality of a radio button, yet have the option of choosing
I am trying to add a radio button click event at runtime. Radiobutton button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.