Created
May 15, 2014 11:03
-
-
Save anandkumar/38fe42dfbf35cf9eafa3 to your computer and use it in GitHub Desktop.
Add support for multiple custom post type - Author hReview Plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add meta box to all post_types | |
// Customised by Anand Kumar @blogsynthesis.com | |
function ta_mytheme_post_add_box() { | |
global $wpar_meta_box; | |
$post_types = get_post_types(); | |
foreach ( $post_types as $post_type ) { | |
add_meta_box($wpar_meta_box['id'], $wpar_meta_box['title'], 'ta_mytheme_post_show_box', $post_type, $wpar_meta_box['context'], $wpar_meta_box['priority']); | |
} | |
} | |
// Add meta box to selected post types i.e. post, page and reviews (as shown in the example below) | |
function ta_mytheme_post_add_box() { | |
global $wpar_meta_box; | |
$types = array( 'post', 'page', 'reviews' ); | |
foreach( $types as $type ) { | |
add_meta_box($wpar_meta_box['id'], $wpar_meta_box['title'], 'ta_mytheme_post_show_box', $type, $wpar_meta_box['context'], $wpar_meta_box['priority']); | |
} } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment