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 suspect that this is not possible right now, but oh well.. I'll ask, maybe one of you has some intersting thoughts to share.

So let's say we have the following taxonomy terms meta-boxes on our post edit page :

  • Team accounting
  • Team supergurus
  • Countries
  • Team developers
  • Favorite ice cream

Wouldn't it be nice to be able to groupe the three "Team" meta-boxes into one "container" box called "Teams" ? This would be just and empty meta-box with a title, containing the three taxonomy meta-boxes.

The goal is to be more user friendly and keep the similar meta-boxes grouped together (it can become really confusing when you have a lot of taxonomies)

Do you think this is doable ?

share|improve this question
1  
very doable using jQuery! –  Bainternet Jun 28 '11 at 12:24
1  
deluxeblogtips.com/p/meta-box-script-for-wordpress.html check out this meta box script. I use it for all my meta boxes, but it's also easy to group them together into boxes using this. If you don't feel like implementing the whole thing, I'm sure you can also peep the code. For instance, I have a box with the title, 2 text fields and some radio buttons in there –  Rev. Voodoo Jun 28 '11 at 13:22
1  
@Bainternet, thanks that was the easiest for me, I posted the code below. –  mike23 Jun 28 '11 at 13:43

1 Answer 1

up vote 6 down vote accepted

Thanks for the hint Bainternet, indeed this is very easy to implement with jQuery.

Example (the four meta boxes are closed for clarity) :

Example of four taxonomy meta-boxes grouped into a container meta-box

Here's what I did :

var $j = jQuery.noConflict();
$j(document).ready(function() {
    $j("#side-sortables").append('<div id="container_div" class="postbox meta-box-sortables ui-sortable"><div class="handlediv" title="Click to toggle."><br></div><h3 class="hndle"><span>Container Meta Box</span></h3><div id="container_inside" class="inside"></div></div>');
    $j("#my_metabox_div").appendTo("#container_inside");
    $j("#my_other_metabox_div").appendTo("#container_inside");
    etc...
});

I added the classes meta-box-sortables and ui-sortable to the container div, that way you can also reorder the boxes within the container (though it's kind of tricky, the div jumps easily..).

This script is then called on the admin page we want with :

function add_admin_scripts( $hook ) {
    // load script on new post page
    if ( $hook == 'post-new.php' ) {
        wp_enqueue_script( 'group_meta_boxes', get_bloginfo('template_directory').'/js/group_meta_boxes.js' );
    }
}
add_action('admin_enqueue_scripts','add_admin_scripts',10,1);
share|improve this answer
    
That was quick, just got back home to post an answer very similar to this , but i can see you go it. –  Bainternet Jun 28 '11 at 13:46

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.