Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want the user to fill in a form (when they create a new blog post). The results of the form should be embedded within the new blog post. So I am trying to think of the best way of coding this. Meta boxes might be the best way?



Edit, the original question changed a little. The old one was:

How can I add a Dashboard Widget into a custom Plugin Options Page?

I have followed the example here http://codex.wordpress.org/Dashboard_Widgets_API to create a custom Dashboard Widget, but cannot see how to add it into my custom plugin options page (which is found under the 'Settings' sidebar in the Control Panel).

share|improve this question
1  
Dashboard widgets are for the dashboard, anywhere else they're just widgets/metaboxes. Are you wanting to register a widget for the dashboard inside a plugin and provide a checkbox/field to toggle activation of said registered widget? –  t31os Jan 4 '11 at 16:23
    
Thank you for the information. MathSmath has now given me the information I need in the answer (edited). –  Techboy Jan 5 '11 at 10:01
add comment

2 Answers 2

up vote 2 down vote accepted

Dashboard widgets only go on the dashboard. You can't put 'em on any other pages, as far as I know.

For a primer on plugin options, see the codex article on creating plugin options pages.

Is there any reason you need to add a widget-style meta box in your settings page? Are you after the drag-and-drop functionality, or the expand-collapse functionality? If so, you might modify your question to ask for those things specifically.

EDIT What you're looking for (based on your comments) are called meta boxes, not widgets (it takes a while to learn all the WordPress-specific terminology). There are some easy-to-use WordPress functions for adding meta boxes to the post creation/editing page--you don't need to create a separate admin page for them.

To actually save the information entered into these boxes, you'll want to hook into the save_post action.

This is all explained (including a copy/paste example you can play with) in the codex article on the add_meta_box function.

share|improve this answer
    
Thank you for the answer. The reason I was looking to do this is explained in my question wordpress.stackexchange.com/questions/6241/… Please let me know if you can think of a better way of doing what I want to achieve :-) –  Techboy Jan 4 '11 at 11:45
1  
I'm confused by your reference to that other question... are you trying to add fields to the post creation/editing page, or to a plugin options page? They use different techniques. –  MathSmath Jan 4 '11 at 15:26
    
I want the user to fill in a form (when they create a new blog post). The results of the form should be embedded within the new blog post. So I am trying to think of the best way of coding this –  Techboy Jan 4 '11 at 16:42
1  
Ah, I see! I've updated my answer. For posterity, you might want to change the question to something like "How to add meta boxes to the post creation screen" to help folks who might be searching through the questions. The answer I gave has little to do with dashboard widgets. –  MathSmath Jan 4 '11 at 18:24
    
I will give the meta boxes a try. Thank you! :-) –  Techboy Jan 5 '11 at 10:00
add comment

You can find an example for custom meta boxes on posts and pages i this repository: https://github.com/bueltge/different-type The example save 3 areas wioth values.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.