Skip to content

Commit

Permalink
Merge pull request #7 from tollmanz/master
Browse files Browse the repository at this point in the history
Adds support for "context" and "priority" (issue #5)
  • Loading branch information
kovshenin committed Sep 2, 2011
2 parents ff1ac7d + 3b24750 commit 662ad15
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions post-options-api.php
Expand Up @@ -267,7 +267,7 @@ function _admin_init() {
// Adds the metabox for each post type
foreach ( $this->post_types as $post_type => $sections )
foreach ( $sections as $section_id )
add_meta_box( 'post-options-' . $section_id, $this->sections[$section_id]['title'], array( &$this, '_meta_box_post_options' ), $post_type, 'normal', 'default', array( 'section_id' => $section_id ) );
add_meta_box( 'post-options-' . $section_id, $this->sections[$section_id]['title'], array( &$this, '_meta_box_post_options' ), $post_type, $this->sections[$section_id]['context'], $this->sections[$section_id]['priority'], array( 'section_id' => $section_id ) );

// Register the save_post action (for all post types)
add_action( 'save_post', array( &$this, '_save_post' ), 10, 2 );
Expand Down Expand Up @@ -426,10 +426,12 @@ function _meta_box_post_options( $post, $metabox ) {
}

// Register a post options section
public function register_post_options_section( $id, $title ) {
public function register_post_options_section( $id, $title, $context = 'advanced', $priority = 'default' ) {
if ( ! isset( $this->sections[$id] ) ) {
$this->sections[$id] = array(
'title' => $title
'title' => $title,
'context' => $context,
'priority' => $priority
);
return true;
}
Expand Down

0 comments on commit 662ad15

Please sign in to comment.