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

  • SEARCH
  • Home
  • 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 8149317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:49:35+00:00 2026-06-06T14:49:35+00:00

I have built a WP theme with an options panel, and I have a

  • 0

I have built a WP theme with an options panel, and I have a small issue.

If you are looking at the code below, I have two checkboxes (type="radio")
The problem is that these checkboxes are not keeping their option after I refresh the options page, but they are added to the database because I see the changes in front-end.

public static function optionsframework_slider_function($id,$std,$oldorder,$order,$int){

    $data = get_option(OPTIONS);
    
    $slider = '';
    $slide = array();
    $slide = $data[$id];
    
    if (isset($slide[$oldorder])) { $val = $slide[$oldorder]; } else {$val = $std;}
    
    //initialize all vars
    $slidevars = array('type', 'title', 'desc', 'content');
    
    foreach ($slidevars as $slidevar) {
        if (!isset($val[$slidevar])) {
            $val[$slidevar] = '';
        }
    }
    
    //begin slider interface    
    if (!empty($val['title'])) {
        $slider .= '<li><div class="slide_header"><strong>'.stripslashes($val['title']).'</strong>';
    } else {
        $slider .= '<li><div class="slide_header"><strong>Slide '.$order.'</strong>';
    }
    
    $slider .= '<input type="hidden" class="slide pixy-input order" name="'. $id .'['.$order.'][order]" id="'. $id.'_'.$order .'_slide_order" value="'.$order.'" />';

    $slider .= '<a class="slide_edit_button" href="#">Edit</a></div>';
    
    $slider .= '<div class="slide_body">';
    
    $slider .= '<label>Slide Type</label>';
    $slider .= '
    <div class="slide pixy-checkbox">
    <input class="slide pixy-input pixy-slider-type" name="'. $id .'['.$order.'][type]" type="radio" value="html"><div>HTML Slide</div>
    <input class="slide pixy-input pixy-slider-type" name="'. $id .'['.$order.'][type]" type="radio" value="video"><div>Video/ Image Wide Slide</div>
    </div>
    ';
    
    
    $slider .= '<label>Slide Title</label>';
    $slider .= '<input class="slide pixy-input pixy-slider-title" name="'. $id .'['.$order.'][title]" id="'. $id .'_'.$order .'_slide_title" value="'. stripslashes($val['title']) .'" />';
    
    $slider .= '<label>Slide Description</label>';
    $slider .= '<input class="slide pixy-input" name="'. $id .'['.$order.'][desc]" id="'. $id .'_'.$order .'_slide_desc" value="'. $val['desc'] .'" />';
    
    $slider .= '<label>Slide Content</label>';
    $slider .= '<textarea class="slide pixy-input" name="'. $id .'['.$order.'][content]" id="'. $id .'_'.$order .'_slide_content" cols="8" rows="8">'.stripslashes($val['content']).'</textarea>';

    $slider .= '<a class="slide_delete_button" href="#">Delete</a>';
    $slider .= '<div class="clear"></div>' . "\n";

    $slider .= '</div>';
    $slider .= '</li>';

    return $slider;
}

The code for checkboxes is (*it can be found in the code above):

$slider .= '<label>Slide Type</label>';
        $slider .= '
        <div class="slide pixy-checkbox">
        <input class="slide pixy-input pixy-slider-type" name="'. $id .'['.$order.'][type]" type="radio" value="html"><div>HTML Slide</div>
        <input class="slide pixy-input pixy-slider-type" name="'. $id .'['.$order.'][type]" type="radio" value="video"><div>Video/ Image Wide Slide</div>
        </div>
        ';

Here is the code that prints the slider in the frontend:

<?php
            $slides = $data['pixy_pixyGallery_slider'];
            if($slides) {
                foreach ($slides as $slide) {
                    echo '<li data-type="'.$slide['type'].'" data-title="'.$slide['title'].'" data-caption="'.$slide['desc'].'">';
                    echo do_shortcode( $slide['content'] );
                    echo '</li>';
               }
            }
            ?>
  • 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-06-06T14:49:36+00:00Added an answer on June 6, 2026 at 2:49 pm

    something like?

    $slider .= '<label>Slide Type</label>';
    $slider .= '<div class="slide pixy-checkbox">';
    
    $slider .= '<input class="slide pixy-input pixy-slider-type" name="'. $id .'['.$order.'][type]" type="radio" value="html"';
    if($order=='html'){ $slider .= 'checked="checked">'; }else{ $slider .= '>' }
    $slider .="<div>HTML Slide</div>";
    
    $slider .= '<input class="slide pixy-input pixy-slider-type" name="'. $id .'['.$order.'][type]" type="radio" value="video"';
    if($order=='video'){ $slider .= 'checked="checked">'; }else{ $slider .= '>' }
    $slider .= '<div>Video/ Image Wide Slide</div>';
    $slider .= '</div>';
    

    this depends on the value of $order to see if its set to a preset value?
    you need to know this value in-order to check it against!

    or set it to check the option value(if you have set 1!)? which ever is easier.

    Marty

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have two byte[] arrays, is there a built-in function to compare them
I have built a child theme in wordpress. I'm using jQuery to hide and
I have a form built in Adobe Dreamweaver. It works, but when the checkboxes
I have built a set of servlets and bundled them all in a WAR.
I have built the Boost library from these instructions: http://stackoverflow.com/questions/3529163/install-boost-library-in-visual-c-2008 Directory of the unzipped
I have 2 separate scripts that essentially do the same thing. I built them
Does Java have a built-in Antivirus? One of my friends told me there is
We have a system built on seam/richfaces. There's this webpage where the tables are
I have a WF4 workflow service deployed in AppFabric. Is there any built-in way
We have several product lines built around a common core and currently maintain them

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.