Skip to content

Commit

Permalink
Fix AeriaSection multiple id #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele Diener committed Jul 28, 2016
1 parent 63753fb commit 34610f0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions classes/AeriaSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public static function register($args){

if(empty($args['type'])) die("AeriaSection: You must define a post_type id");
if(empty($args['title'])) $args['title'] = 'Sections';

add_action('add_meta_boxes', function() use ($args){
$section_id = 'aeria_section' . ( !empty($args['id']) ? "_{$args['id']}" : "" );
add_action('add_meta_boxes', function() use ($args, $section_id){
foreach ( (array) $args['type'] as $type ) {
add_meta_box(
'aeria_section' . ( !empty($args['id']) ? "_{$args['id']}" : "" ),
$section_id,
$args['title'],
function($post) use ($args) {
AeriaSection::render_controls($args);
Expand All @@ -24,8 +24,8 @@ function($post) use ($args) {
});

foreach ( (array) $args['type'] as $type ) {
add_filter( 'postbox_classes_' . $type . '_aeria_section', function( $classes ) use ( $args ) {
array_push( $classes, 'aeria_section_' . $args['title'] );
add_filter( "postbox_classes_{$type}_{$section_id}", function($classes) use ($args, $section_id) {
array_push( $classes, $section_id );
return $classes;
});
}
Expand Down

0 comments on commit 34610f0

Please sign in to comment.