Our blog, keeping you up-to-date on our latest news.

 

Custom WordPress Theme Options

February 15, 2011 at 6:24 pm | Blog, CMS, Code, Wordpress | No comment

 

As I continue to build Web sites for people I find myself using WordPress for all of the content management. I’ve grown so accustomed to it, that I can’t believe I used to code every Web site from scratch.

WordPress is slick. Not only does it give the client more power to update content on their own, but it also makes developing easier and more robust on my end. I recently learned about shortcodes and how to implement them in my themes. Shortcodes make styling content in the WYSIWYG really easy without the user having to know about complex code and syntax.

I just built a new Web site for Revista Caminos, a local Latino publication, and in the process I had need for a way to let the client change things about the site theme. One way I know to do that would be to create a page/post, call it “Theme Options”, and add a bunch of custom fields. But that would be messy and not very good design.

I knew it was possible to have a theme options link in the WordPress menu as I have seen it done on other people’s templates. This lead me to do some research on the Web. After a little bit of searching, reading, and some trial and error, I stumbled upon a great blog post that wrapped everything up in a download.

Great Tutorial with Download

I plopped the files in my theme directory, included a link in my Functions.php file and I was done! Very easy to implement after that. I just created the checkboxes and input fields I needed and I was ready to go.

Using the options in your theme design is really simple. Just pull out the options using:
$options = get_option(‘my_options’);

Then use an option:
$bgd_url = $options['bgd_url'];

Custom Theme Options Screenshot:

<< Back to Blog Discuss this post

 
No Comments to “Custom WordPress Theme Options”
Leave a Comment

Categories:

Archives: