Creating Custom Options Pages in WordPress


#1

Notice: This is a discussion thread for comments about the SitePoint article, Creating Custom Options Pages in WordPress.


Show us your new great power! How far can you take your Options page further?


#2

where is the file I can download located that is mentioned in the video?


#3

So... I'm the only person that can't get this to work, eh?
I get the "Theme Options" in the Settings panel just fine, but all clicking that does is refresh my Dashboard...
No need to post the code here, I don't think, as I am merely copying/pasting right from the article...
This is a localhost installation that, otherwise, works just fine... Any thoughts/guesses?
Thanks,
Atg


#4

I agree with akshayaurora. There should be a link to download the code.
I believe this is on topic. Just some related thoughts and questions for those following this thread. If you have built an options page using the Options API and then one using the Settings API, which do you think is better as far as efficiency and security? I have spent the last few days digging into the Settings APIi and it sure seems like a lot of work in contrast to the Options API. Maybe if one built a class to do all of this it would be lighter. Does anyone have any experience building a settings API class, or know of a tutorial on the subject? I'm not versed in OOP and maybe the code isn't fit for a class. What do you think?


#5

That
was
awesome

Thanks so much.


#6

Awesome post… Thanks for the share....


#7

Thanks for cool information, but let me know is it free of cost.:shifty:


#8

Great article/tutorial.

If you'd like to add your "sub-menu" to a section other than the "Settings" menu use the following:

add_dashboard_page(...) // Add sub-menu to Dashboard menu
add_posts_page(...) // Add sub-menu to Posts menu
add_media_page(...) // Add sub-menu to Media menu
add_links_page(...) // Add sub-menu to Links menu
add_pages_page(...) // Add sub-menu to Pages menu
add_comments_page(...) // Add sub-menu to Comments menu
add_theme_page(...) // Add sub-menu to Appearance menu
add_plugins_page(...) // Add sub-menu to Plugins menu
add_users_page(...) // Add sub-menu to Users menu
add_management_page(...) // Add sub-menu to Tools menu

For different icons, buttons, and other admin panel styles see: How to design and style your WordPress plugin admin panel (Onextrapixel.com)


#9

nevermind I found the link above... would be nice if it was on the article page though...:)


#10

I'm also getting a "Fatal error: Call to undefined function add_settings_section()." I'm also trying to get this to work on localhost.

Jeffrey, PLEASE post the finished admin-menu.php code as a download. The tutorial jumps around so much it's hard to see what code goes where.


#11

In case someone can't get this to work on a local setup and need some practical advice, replace all instances of:

__FILE__

with:

basename(__FILE__)

And you're good to go.


#12

I can't seem to edit my own post any more. frowning Anyway, I found the complete code for this tutorial (?) over at Github: http://github.com/JeffreyWay/WordPress-Theme-Options-Page


#13

Issue was "FILE" when on a localhost...

Argh...

Atg


#14

Thanks Jeffrey! I've been looking through TONS of pages to find something like this. On the video tutorial you mention downloading the source code, but I don't see a link for that. Will that still be available? Thanks!


#15

Thanks. I am looking for how to have an options page change something that normally is configured in a css file. Is this possible, to change the css file on the fly?


#16

Do you want to change the style of only one element or switch the style of the site overall? If you want to change the overall style you can create several style sheets and use a select box to choose which style to use. This can be accomplished via PHP or Javascript. There are tons of tutorials out there Google away! If you want to change an element of your pages that can also be done via a form to post to a css value applied by php. Ditto: Google.


#17

Its great to developed creative custom option and such a revealing information you share with us, We learn a lot from it and will be in touch with you for more add-ons. Wish you all the best.

<snip />


#18

Please add the source code link.


#19

I didn't "follow through" close enough. I missed adding statements to the register_build_options function. Onward and upward!

Thanks again


#20

Jeffrey, thanks for the great article. It's well explained and laid out. I really appreciate the work you've done with books and articles.
I've followed through to the point of "rendering the outputs" and am getting a php error "Call to undefined function add_settings_section()". I've looked through the code and tried changing several things with no luck. I copied the code exactly and still get the error. Any thoughts?
I'm also wondering about the use of the $plugin_options variable in the validate_setting function. Is that correct to use that variable there?