[wp-hackers] Adding a checkbox to the write articles page
Mitesh Ashar
email at miteshashar.com
Tue Jan 22 14:29:01 GMT 2008
OK.
Are you hooking this function?
Just writing the function is not enough.
And yeah the function u've given is the one to process your checkbox, and
not show it..
I guess u will be having a function to show it.
All of these functions need to be hooked.
The one to show the checkbox needs to be hooked to dbx_page_advanced &
dbx_post_advanced.
This will show your checkbox just below the Upload form.
The one to process the checkbox needs to be hooked to edit_post, save_post &
publish_post.
For more about action & filter hooking a function to different events, check
http://codex.wordpress.org/Plugin_API
-Mitesh
Date: Tue, 22 Jan 2008 08:33:58 +0000
From: M?rio Gamito <gamito at gmail.com>
Subject: [wp-hackers] Adding a checkbox to the write articles page
To: wp-hackers at lists.automattic.com
Message-ID: <4795AA76.7080909 at gmail.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi,
I'm trying to write a plugin to add a checkbox to the write articles
page, but it doesn't appear.
My code is:
function sapo_tags($id)
{
//delete the existing field
delete_post_meta($id, 'checkbox');
//Get the value from your form
$userEnteredValue = $_POST["userEnteredValue"];
//Add your value as a custom field with the key 'myKey'
//but only if the form data exists
if (isset($userEnteredValue) && !empty ($userEnteredValue)){
add_post_meta($id, 'checkbox', $userEnteredValue);}
}
Any ideas ?
Any help would be appreciated.
Warm Regards,
Mário Gamito
More information about the wp-hackers
mailing list