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 to create an input field in the dashboard where I can put in links or text which will update a section I define on the actual website. I know I can just edit the template but I want to make things easier for the client.

To be a bit more specific, I have a 'latest updates' section in the header and the client has requested that he'd like to update this manually. So I'd like to create an input box of some sort in the dashboard so he can easily enter text (or links), click save, and have it reflected on the website (in the header).

Can someone give me a starting point?

share|improve this question
1  
The simple way is to use the Widgets API codex.wordpress.org/Widgets_API or a plugin or a custom post type. –  Wyck Mar 27 '11 at 23:17
    
thanks, I'll use widgets. –  jwp Mar 28 '11 at 1:14
add comment

1 Answer

This is pretty easy to do with the Dashboard Widgets API http://codex.wordpress.org/Dashboard_Widgets_API.

Here are the steps I would take to create this:

  1. Queue up a jQuery script for AJAX handling
  2. Create a PHP AJAX function and corresponding AJAX hook for saving the form data
  3. Create the dashboard widget with HTML form input(s)

Here's a sample for adding a simple dashboard widget:

function foo_dash_widget_content() {
    //Insert your form element with AJAX capability
}

function foo_dash_widget() {
    wp_add_dashboard_widget('foo-dash', __('Foo Dash Widget', 'foodash'), 'foo_dash_widget_content');
} 
add_action('wp_dashboard_setup', 'foo_dash_widget');
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.