WordPress Theme Options – Round 2

Categories: Blog, Development, WordPress
Tags: , , , , , , , , , ,

Apr 10
2011

The other day I was Looking at WordPress Theme Options and ended up coming up with a simple way to add options to your own theme. Not too long after that a friend asked for some help with a theme he had adapted.

In this theme he had options available that would allow the user to set articles on the main page of the site by placing the page or post ID in a text input field.  I’ve seen this method before – in fact I’ve used it myself. I just never liked it.

The problem is that since WordPress doesn’t show the page or post ID anywhere except in the browser status bar or in the URI in your browsers address bar.  If you’re not showing the status bar then you have to click on the post, look for the URI and then jump back to the options page to put it in. Too much monkeying around for my taste.

On my friend’s options page for his theme I added a way to display all the pages/posts in a drop down (select) menu to pick from.  Then this made me think… why not add this to the DMG WordPress Theme Options script? And why not improve upon it?

Ideas for New Features

Pages and posts are nice but what about categories, tags and even authors? Okay that shouldn’t be a problem. Now how to display them?

At first I thought that just a nice drop down menu would be fine.  The issue here was with categories and tags, you often want to select more than one.  But of course their may be a reason you’d only want one picked from the list – example:  ‘Show only posts from this category on the main page’.

The only thing to do was let the developer of the theme decide how he or she would be using the pages, posts, categories, tags and/or authors. Yup… flexibility is needed!

The Solution

The solution – and soon to be included in the new release of the DMG WordPress Theme Options script – was to add the new type wordpress as well as two new keys for the setup array: wptype and wpas.

wptype will allow the developer to select from WordPress pages, posts, categories, tags and/or authors.

wpas will allow the developer to pick the input format from select (drop down) list, multiple select list, checkboxes and/or radio buttons.

Release Date

The code is done, the testing is in progress but there were a few minor changes and other additions I was working on as well.  I’ll have to update the manual a bit too before I feel it’s documented enough to release.  Hopefully, though, the new version of DMG WordPress Theme Options will be released this week.

 

Comments

Leave a comment

 

Leave a comment

Read comments

 



Please do not submit your comment more than once. It will appear once it has been approved.