[wp-hackers] need help to implement customized "write post"

AJ Chen canovaj at gmail.com
Fri Jun 9 17:20:02 GMT 2006


I'm new to wp plugin development, and would appreciate your help for
implementing a new "write specific post" feature.  I looked at
StructuredBlogging plugin for wordpress, which has similar features. It's a
great plugin, but the implementation requires massive rewriting wordpress
functions.  I hope to have a much simpler approach that only uses existing
pluging API. Here is my apporach:

function w2x_add_pages() {
    add_submenu_page('post-new.php', 'Write Experment Post', 'Experiment
Post', 8, 'post-exp', 'w2x_show_exp_post');
}
function w2x_show_exp_post() {
    //should set a variable here to indicate a special post type.  what
global variable to use?
    wp_redirect("http://localhost/wordpress/wp-admin/post-new.php");
}
add_action('admin_menu', 'w2x_add_pages');

function w2x_prefill_post($post_content) {
    // How to find out what type of post it is?  If it's special post,
modify the default content.
    return $post_content;
}
add_filter('default_content', 'w2x_prefill_post');

I'm having problem in finding out the type of post inside the filter
function. Is there a global variable to set before redirecting the page?
This variable will be used in the filter function to do approriate
filtering.

Is there a better approach than wp_redirect?  I basically want to use the
same post-new.php and pre-fill the write area with some text. Appreciate any
advice.

Thanks,
AJ


More information about the wp-hackers mailing list