As I’m revising this blog (so far), retrospectively updating elements and enhancing my own plug-in, I decided it’d be cool to be able to have a “featured div” sometimes, in place of a “featured image”.
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php
if (has_post_thumbnail()) {
echo '<div class="single-post-thumbnail clear">';
echo '<div class="image-shifter">';
the_post_thumbnail();
echo '</div>';
echo '</div>';
}
else if ( get_post_meta( $post->ID, 'featured-div', true ) )
{
echo '<div style="max-width: 100%; overflow: hidden;" class="single-post-thumbnail clear">';
echo '<div class="image-shifter">';
echo get_post_meta($post->ID, 'featured-div', true);
echo '</div>';
echo '</div>';
}
else if ( get_post_meta( $post->ID, 'featured-xpost', true ) )
{
// get custom post type xpost by slug, and insert
// so that shortcodes are processed getting the content
echo '<div style="max-width: 100%; overflow: hidden;" class="single-post-thumbnail clear">';
echo '<div class="image-shifter">';
$xpostslug = get_post_meta($post->ID, 'featured-xpost', true);
$args = array(
'name' => $xpostslug,
'post_type' => 'xpost',
'post_status' => 'publish',
'numberposts' => 1
);
$my_posts = get_posts($args);
if( $my_posts )
{
// echo 'ID on the first post found ' . $my_posts[0]->ID;
// echo $my_posts[0]->post_content; // this wouldn't process the shortcodes
$xpostID = $my_posts[0]->ID;
echo do_shortcode(get_post_field('post_content', $xpostID));
}
else
{
echo 'ERROR: FEATURED XPOST NOT FOUND';
}
echo '</div>';
echo '</div>';
}
?>