Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

add settings page to plugin using settings api WordPress

Hi I'm trying to output a settings page on my wordpress plugin using the wordpress settings api.

I'm using this boilerplate [[LINK href="http://tommcfarlin.github.io/WordPress-Plugin-Boilerplate/"]][[/LINK]] http://tommcfarlin.github.io/WordPress-Plugin-Boilerplate/ which outputs the settings page like this:

public function display_plugin_admin_page() {
include_once( 'views/admin.php' );
}


so how do I now set up the settings using the settings api? I've looked at various tutorials but none of them are dumbed down enough for me! It would be helpful if someone could supply me with some demo code for each type of input, i.e. text, radio, checkbox etc that I can output in my views/admin.php.

Thanks
Will

Answers (5)

2013-08-15

Remy answers:

Did you try the settings api tutorial on WP Tuts ? http://wp.tutsplus.com/tutorials/the-complete-guide-to-the-wordpress-settings-api-part-1/


willcm comments:

I'm having trouble with all the tutorials because the boilerplate outputs a separate settings page and I have no idea which code goes where


Remy comments:

You should add the settings code found in the tutorial in the views/admin.php file


willcm comments:

nope doesnt work

2013-08-15

Yakir Sitbon answers:

You can see my simple setting api page..
https://github.com/KingYes/wordpress-aryo-activity-log/blob/master/classes/class-aal-settings.php


willcm comments:

ok but where do I put this code - if you look at the bolierplate http://tommcfarlin.github.io/WordPress-Plugin-Boilerplate/ it has 2 files, class-plugin-name.php and then /views/admin.php which is where the settings form is...

2013-08-15

Sabby Sam answers:

Try this one

http://net.tutsplus.com/tutorials/wordpress/how-to-create-a-better-wordpress-options-panel/


willcm comments:

I'm having trouble with all the tutorials because the boilerplate outputs a separate settings page and I have no idea which code goes where

2013-08-17

Krum Cheshmedjiev answers:

Sorry, it's your priority to ask questions here, but I could not understand: which settings you want to show: Settings of WP, theme settings or settings of your plugin? Also, on which page: WP settings page, your plugin's settings page, theme settings page, on usual post/page etc...

Sorry again, but with so much possibilities I can not suggest good solution...

2013-08-17

Just Me answers:

You need to define your settings-form in view/admin.php but you also should uncomment line 71 of class-plugin-name.php file.

Does nothing happen or do you end up with an empty settingspage?