Skip to content

Instantly share code, notes, and snippets.

@farinspace
Created February 1, 2012 21:34
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 farinspace/1719607 to your computer and use it in GitHub Desktop.
Save farinspace/1719607 to your computer and use it in GitHub Desktop.
Using WP Alchemy output_filter
$custom_metabox = new WPAlchemy_MetaBox(array
(
'id' => '_custom_meta',
'title' => 'My Custom Meta',
'template' => get_stylesheet_directory() . '/custom/meta.php',
'output_filter' => 'my_output_filter',
));
function my_output_filter ( $post_id )
{
$page_template_file = get_post_meta( $post_id, '_wp_page_template', true );
$post_template_file = get_post_meta( $post_id, '_wp_post_template', true );
if ( 'post-template.php' == $post_template_file || 'page-template.php' == $page_template_file )
{
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment