I think you are hearing “crickets” because there are several component to this. You need to:
- Create a meta_box
- Save data from that meta box
- And build a Loop on the front
For #1 and #2:
function add_featured_meta_box() {
add_meta_box("featureddiv", "Featured Post", "featured_post_meta_box", 'post', "side", "low");
}
add_action("do_meta_boxes", "add_featured_meta_box");
function featured_post_meta_box(){
global $post;
$custom = get_post_custom($post->ID);
$featured = (!empty($custom["_featured"][0])) ? $custom["_featured"][0] : ''; ?>
<table>
<tr>
<td>Featured
<td> <input type="checkbox" name="featured" <?php checked($featured,true); ?> /> </td>
</tr>
</table><?php
}
function save_featured_meta($postid,$post){
global $_POST;
// set the ID to the parent post, not the revision
$postid = (wp_is_post_revision( $postid )) ? wp_is_post_revision( $post ) : $postid;
$post_type = get_post_type( $postid );
if (isset($_POST['featured'])) {
update_post_meta($postid, "_featured", true);
} else {
delete_post_meta($postid, "_featured", true);
}
}
add_action('save_post', 'save_featured_meta', 1, 2);
And for #3:
$args = array(
'post_type' => 'post',
'ignore_sticky_posts' => true,
'meta_query' => array(
array(
'key' => '_featured',
'value' => true,
)
)
);
$query = new WP_Query( $args );
Barely tested. Possibly buggy. Caveat emptor. No refunds.