Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Using core meta boxes elsewhere WordPress

  • SOLVED

Hi

Has anyone successfully used core meta boxes (eg Post Tags) on other parts of the dashboard?

I have two requirements: one to use a custom taxonomy meta box on the add link page and secondly to use the Post Tags box on a custom settings page.

I've tried this code for the first requirement:

$tax_name ='countries';
$taxonomy = get_taxonomy($tax_name);
if ( ! $taxonomy->show_ui )
continue;

$label = $taxonomy->labels->name;

if ( !is_taxonomy_hierarchical($tax_name) )
add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'link', 'normal', 'high', array( 'taxonomy' => $tax_name ));



but with only small joy - the box appears, but doesn't function.

It feels like some javascript is missing, but I don't know what.

Suggestions?

Answers (2)

2011-01-05

Peter Michael answers:

Maybe this helps:

[[LINK href="http://shibashake.com/wordpress-theme/standard-wordpress-metabox"]]http://shibashake.com/wordpress-theme/standard-wordpress-metabox[[/LINK]]


John Cotton comments:

Thanks Peter, that's a helplink.

This is what I was missing to get the custom taxonomy on the link page:


wp_enqueue_script('post');


Any suggestions about getting the standard tags box onto a custom settings page (it's acutally popped up via an ajax call)? I suppose my question is: what page name do I use for the first parameter of this?


do_meta_boxes('settings_page_shiba_test', 'side', $test_object);


2011-01-05

Denzel Chia answers:

Hi,

I believe what you want is in this tutorial.
http://www.deluxeblogtips.com/2010/07/custom-post-type-with-categories-post.html

Thanks.


John Cotton comments:

Thank Denzal, but that's not what I'm after.

I want to use the meta-boxes elsewhere - for example on a custom settings page that pops up via ajax on some extensions I've written. They use custom tables and so are unrelated to the main flow of WordPress.

JC