Skip to content

Instantly share code, notes, and snippets.

@anandkumar
Created May 15, 2014 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anandkumar/38fe42dfbf35cf9eafa3 to your computer and use it in GitHub Desktop.
Save anandkumar/38fe42dfbf35cf9eafa3 to your computer and use it in GitHub Desktop.
Add support for multiple custom post type - Author hReview Plugin
<?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