Created
February 5, 2013 03:36
-
-
Save devinsays/4711952 to your computer and use it in GitHub Desktop.
Featured Image Meta:
http://wptheming.com/2013/01/featured-image-meta/
This file contains hidden or 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 a checkbox to the featured image metabox */ | |
add_filter( 'admin_post_thumbnail_html', 'theme_featured_image_meta'); | |
function theme_featured_image_meta( $content ) { | |
global $post; | |
// Text for checkbox | |
$text = __( "Don't display image on post.", 'textdomain' ); | |
// Meta value ID | |
$id = 'hide_featured_image'; | |
$value = esc_attr( get_post_meta( $post->ID, $id, true ) ); | |
// Output the checkbox HTML | |
$label = '<label for="' . $id . '" class="selectit"><input name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $value . ' "'. checked( $value, 1, false) .'> ' . $text .'</label>'; | |
return $content .= $label; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment