#### Pages Drop-Down

Next is another similar drop-down option which selects a page name. The code for this is very similar to the previous one:

#### The Options Array

All our options will be stored in their own arrays so that we can mass-process them later in the code:

Each array is one option, and contains name, desc, id and type parameters. The ID is very important, and is what we'll be using to reference the option later in the code. For example, to get the Portfolio Category, we would check the $ts_portfolio_cat (ts is the shortname we referenced at the top of the document.) #### Options Back-end The following code makes our options page appear in the Dashboard (it's under "Design" in WordPress 2.6 or below), and saves the options into the database. We're not going to go through the code as it would take this tutorial off-track too much. Just copy & paste it and think of it as some magic code from the WordPress Gods which makes your theme work. This next code checks each of our options for their type attribute, and styles them into a table. So options with "type" => "select" would output as a drop-down box, or "type" => "textarea" would output as a textarea. Finally, at the end of the file, insert: We require() our var.php file which will contain code for retrieving our options. Note that we have to use TEMPLATEPATH in require() or include() tags so that it is browsing to our theme directory, and not the root WordPress directory. ## Retrieving These Options Now those options are in the Dashboard, we need to be able to use them in our theme. Insert the following code into var.php: The first section of the code retrieves all our options from the database. However we have a problem: our Category & Page options send back the name of the category or page - but we'd prefer the ID as it's easier to use in WordPress functions. The next two parts of the code do exactly that. We run a SQL query to get the appropriate ID. These options are now stored in the $ts_portfolio_cat and \$ts_blogpage variables.

Now we have the admin side finished, login to your Dashboard, and set the appropriate settings for each of the options. Choose deepblue.css for the colour-scheme for now.

## Summary

That concludes Day 1 of WordPress Week. Tomorrow, we'll be creating our homepage layout, making a custom 'WordPress Loop' and handeling widget areas.

Part 2 - Loops and Widgets.