WP Settings Generator: Quickly Create a Custom Options Page Using the WordPress Settings API

photo credit: Leo Reynolds - cc
photo credit: Leo Reynoldscc

Yesterday we featured a plugin, created by application developer Jeroen Sormani, that clones Google Keep functionality in the WordPress dashboard. Sormani has produced a number of other interesting experiment with WordPress, including a little known tool for generating WordPress settings.

The WP Settings Generator is a tool for plugin and theme developers. It generates a custom options page that is fully compatible with the WordPress Settings API standards. The tool is similar to the kinds of generators found at GenerateWP, which lacks a tool for creating settings.

On the config tab you can enter your plugin/theme name, plugin prefix, and text domain. Select your menu position and then proceed to the next tab.

settings-generator

The next screen provides a drag-and-drop interface for adding settings fields:

settings-fields

Once you have added all your fields, you will be presented with your customized settings code, which you can scroll through and copy to your plugin. Although it is designed to create settings pages for themes or plugins, the general consensus these days is that it’s preferable to utilize the native customizer for theme settings.

the-code

After reviewing your code, you have the opportunity to leave a personalized review of the generator. If you find that the code you receive has any errors or seems off, make sure to let Sormani know with a quick comment.

Of course, using a settings generator isn’t going to help you learn how the WordPress Settings API works, but it does give you a quick start for creating options. It’s not so much of a teaching tool but rather designed to eliminate the rote task of writing your own settings. Check it out and let us know if it ends up saving you time.

16

16 responses to “WP Settings Generator: Quickly Create a Custom Options Page Using the WordPress Settings API”

  1. I always used option tree for theme options. I don’t know whether this plugin is more different that what option tree does currently.

  2. Wow this seems a lot better than what GenerateWP offers. It is much more simpler to use as well as understand, at least that’s my take on it. @Sky4git this isn’t a plugin, its an online tool that you use to generate option pages for themes and plugins.

  3. Very helpful resource. It would be nice to add support for a tabbed options page!

    • Hi Joan,

      Jeroen here, creator of WP Settings API, adding an option for Tabs to the generator is on the roadmap for the tool! (if you peek in the source code you may even find a reference to it ;-) )

      ETA is around the end of next month.

      Cheers!

      • Joeroen, you are amazing. That’s a great tool, not only it’s useful for my development, but also to learn how to use the setting API the right way. Thanks so much for your effort, I really appreciate!

        Expecting to see that update next month, you’ll make my day! And month!

  4. Thanks for this resource. As getting into my first plugin to release, this is really useful to help me in getting the knack of creating settings areas for plugins and even themes. It makes the initial concept releasing a plugin a lot more comfortable to dive in and get started. Thanks!

    • Hi,

      That depends on your prefixes and stuff you used, if you look in the generated code, you will see a couple of `get_option()`, you can copy that to use elsewhere.

      Cheers

  5. Wondering what I did wrong … or is this a bad day for the generator? I used a direct cut and paste into an existing plugin file. Attempting to view the generated options page, I get this message:

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘vimeo_downloads_options_page’ not found or invalid function name in —-obscured-site-name—-/wp-includes/plugin.php on line 496

    • Hi Bob,

      I think you might have found a bug!

      If I’m correct you will have function called ‘vd_options_page()’ in your code?
      If so, can you change the ‘vimeo_downloads_options_page()’ in the ‘add_menu_page()’ call to to ‘vd_options_page()’, that should fix it for you right away!

      I will look into this soon!

      Thanks for reporting!

      Cheers,
      Jeroen Sormani

      • Hi Jeroen,
        What good logging you have. PERFECT answer!

        … and I should have searched for that and found it myself.

        THANK YOU, and thanks for a very helpful tool!
        Keep having fun,
        Bob

  6. Thanks! I’m working on writing some simple theme customizations to display featured/recent posts and images on my home page, and I needed to create an options page for configuring the week’s featured post/image … I was struggling with figuring out how to set up a simple admin page, and the WP Settings Generator is perfect for helping me learn how to do it properly.

  7. This did help me learn how the Settings API works, because like any developer worth their salt I used my eyes and my brain to understand the code. Are there still developers that need everything explained to them from scratch? Because they probably shouldn’t be developers.

  8. Would it be completely unethical to use this tool to populate the fields of a Custom Post Type? It seems that by using this tool, I could create a space to have my own custom form that on submit would create a new CPT. Goodbye to the standard (and terrible) editor page, hello to a new CPT Admin page….

Newsletter

Subscribe Via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: