Integrated NHP Options Framework into your WordPress Theme

Before 3 years, I have started to customize the WordPress Theme for my clients, and most clients do not know any CSS, HTML or PHP knowledge, so they hit harded coding when they want to change the settings, then I was googling and found NHP Options Framework, at that time, it’s a big surprise for me! Generally speaking, I like its two columns layout, such as woothemes options, and there are many kinds of options integrated, it’s easy using. If you are also a WordPress designer or developer and looking for such a option framework, I strongly recommend it!

Sorry for my nagging, now I will talk about how to intergrate NHP Options FrameWork into the WordPress Theme. As I said above, it’s easy using, just follow me!

Download NHP resource on Github

Download Link here:

Install it

After you downloaded, unzip the package and move “nhp-options.php” and “options” folder to your theme folder, then open the functions.php of your theme, and add the following code:

<?php if(is_admin()){require_once("nhp-options.php"); } ?>

Also, you can change the file name of nhp-options.php to yours, but don’t change “options” folder name. Then, refresh the WordPress dashbroad, you will see the Theme options link will be displayed in the side menu!

Getting started.

You need initialize it first. Open “nhp-options.php”, find $args[‘opt_name’] = ‘twenty_eleven’; about at line 103, replace ‘twenty_eleven’ to your theme name, for example I change it to “wpl” that’s the most important thing! Also, you can custom the following options which you want to replace to your.

//Custom menu title for options page - default is "Options"
$args['menu_title'] = __('Theme Options', 'nhp-opts');

//Custom Page Title for options page - default is "Options"
$args['page_title'] = __('Twenty Eleven Theme Options', 'nhp-opts');

//Custom page slug for options page (wp-admin/themes.php?page=***) - default is "nhp_theme_options"
$args['page_slug'] = 'nhp_theme_options';

Then, open the functions.php of your theme and add the following code:


The initialization step is finished!

Using the option

First, you should create some options in “nhp-options.php”, please refer to all field typs introduction on its Github wiki:

You should add global $WPL; to every files or functions which you want to use the option, then, use $WPL[‘option_name’] to call the value. That’s it.

Hope this article is helpful for you, if you have any questions, please comment as below 🙂

The article source:

Leave a Reply