How To Add An Options Page To Your Theme (NHP Framework)

The NHP Theme Options Framework is an easy to use free options framework from Freelance Graphic Designer Lee Mason.

On the framework home page Lee acknowledges other great option frameworks such as Options Framework Theme and The UpThemes Framework though points out that neither of them provided him with the extendibility he needed. Specifically he wanted:

Setting up with NHP Theme Framework

  • Section Tabs – Each settings section to have its own “tab” which can be clicked through.
  • Use the WordPress Core Settings API – The settings to use the core WordPress functions for creating/editing settings (no point reinventing the wheel).
  • Custom Error Handling – To be able to display error totals and custom messages for each section/setting.
  • Easily Extendable – To be able to extend the framework for custom use applications, settings fields and custom validation.
  • Customisable – To be able to customise the functionality and style without hacking at the core.
NHP Theme Options Framework

Adding the options to a theme is incredibly easy. You first need to upload the theme-options.php file and options directory to your theme folder (e.g. www.yoursite.com/wp-content/themes/twentyeleven/themeoptions.php and www.yoursite.com/wp-content/themes/twentyeleven/options). Then you need to request the theme-options.php file from your theme via your theme functions.php file.

Once you have added the above line to your theme functions file, you will see a new Theme Options page underneath your appearance section. The framework supports a 28 field type including text areas, check boxes, dates, colours, post type selector and info field.

NHP Text Fields

The framework includes lots of validation classes such as no HTML, date validation, colour validation and string replacement.

NHP Custom Fields

The framework comes with an import and export system built in so that users can save what their configurations.

NHP Import & Export

A number of custom message phrases are included with the framework such as ‘Settings Saved’ and ‘Settings Imported’.

NHP Error Messages

I’ve not developed a theme with a custom options page so I am not in a position to compare it to other option frameworks out there. It does appear to be a very good option though due to it’s flexibility and number of field types to choose from. The code has comments throughout and it is well documented too so you shouldn’t have difficulties modifying it for your own website theme.

More information can be found at the link below.

Thanks,
Kevin

LinkNHP Theme Options Framework