I’m completely stuck.
I’ve been working on a theme that offers 5 different layouts and 3 different skins. In the theme options, I originally was using checkboxes to choose the skin and layout, but was asked (by ThemeForest) to change them to radio buttons. At first, I thought, no problem. Now I’m clueless.
In the header, an example of a layout + skin option was written like this:
<!-- Content Alt (Layout 2)-->
<?php if (( $mp_content_alt == 'true' ) && ( $mp_skin1 == 'true') ){ ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/_styles/skins/l2_coolblue.css" type="text/css" media="screen,projection" />
<?php } elseif (( $mp_content_alt == 'true' ) && ( $mp_skin2 == 'true') ){ ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/_styles/skins/l2_justminimal.css" type="text/css" media="screen,projection" />
<?php } elseif (( $mp_content_alt == 'true' ) && ( $mp_skin3 == 'true') ){ ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/_styles/l2.css" type="text/css" media="screen,projection" />
<?php } ?>
In the functions.php I set up the radio options like this:
$shortname = "mp";
$layout = array("1" => "Original", "2" => "Original + Left Sidebar", "3" => "Wider Images + Right Sidebar", "4" => "Large Images + No Text", "5" => "Smaller Images Gallery");
$skins = array("1" => "Original", "2" => "Cool Blue", "3" => "Just Minimal");
array( "name" => "Choose A Skin",
"desc" => "",
"id" => $shortname."_skins",
"type" => "radio",
"options" => $skins,
"std" => ""),
array( "name" => "Layout Options",
"desc" => "Choose Your Layout",
"id" => $shortname."_layouts",
"type" => "radio",
"options" => $layout,
"std" => ""),
I’m struggling to understand how to call the different radio options? I tried this:
<!-- Content (Layout 1)-->
<?php if ((checked( isset( $mp_layouts['1'] ) ) ) && (checked( isset( $mp_skins['2'] ) ) ) ){ ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/_styles/skins/l1_coolblue.css" type="text/css" media="screen,projection" />
<?php } elseif ((checked( isset( $mp_layouts['1'] ) ) ) && (checked( isset( $mp_skins['3'] ) ) ) ){ ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/_styles/skins /l1_justminimal.css" type="text/css" media="screen,projection" />
<?php } elseif ( (checked( isset( $mp_layouts['1'] ) ) ) && (checked( isset( $mp_skins['1'] ) ) ) ){ ?>
<link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/style.css" type="text/css" media="screen,projection" />
<?php } ?>
But that didn’t work.
Any suggestions?
Thanks very much!
I solved this problem.
First I had to define the option in a variable:
Then I refer to the option within the array:
The array of the different layouts contains: Layout1, Layout2, etc.
The array of the different skins contains: Original, Blue, Minimal, etc.