Options only for select and radio types

an array of the options that users will be able to choose from in select and radio button lists

Let's start with the link color option:

chapter_07/v1/wicked/library/options.php (excerpt)

function childtheme_options() {

$childoptions = array (

array("name" => _('Link Color','thematicl),

"desc" => __('Change the color of links by entering a HEX ^color number, (e.g.: 003333)','thematic'), "id" => "wicked_link_color", "std" => "999999", "type" => "text"),

This is fairly straightforward, right? We're using the_() localization function around the name and description, and setting a unique id. Because we need the user to enter a value, we're setting type to text: this will output a text box.

The array for the header image checkbox will be very similar, but the featured category select box is trickier: we need to provide an options value that will contain all the different categories on the site. Obviously these will vary from one site to another, so we need to retrieve them from WordPress. Fortunately there's a get_categories1 method to do just that:

1 http://codex.wordpress.org/Function_Reference/get_categories

chapter_07/v1/wicked/library/options.php (excerpt)

function childtheme_options() {

Was this article helpful?

0 0

Post a comment