Skip to content

Instantly share code, notes, and snippets.

@jonathan-bird
Created August 19, 2013 23:14
Show Gist options
  • Save jonathan-bird/6275309 to your computer and use it in GitHub Desktop.
Save jonathan-bird/6275309 to your computer and use it in GitHub Desktop.
Wordpress: Featured Work Page - Custom Post Type with custom field for description
<?php get_header(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
global $wpdb;
$metatable = $wpdb->prefix."postmeta";
$post_id = $post->ID;
$deschome = $wpdb->get_results($wpdb->prepare("SELECT meta_value FROM $metatable where post_id=%d AND meta_key='wpcf-featured-work-description-home'",$post_id));
?>
<div class="container">
<div class="work-home">
<div class="work-view">
<div class="work-img">
<a class="html5lightbox" title="" href=""><?php the_post_thumbnail(); ?></a>
</div>
<div class="work-title"><?php the_title(); ?></div>
<div class="work-desc"><?php echo $deschome[0]->meta_value; ?></div>
</div>
</div>
</div>
<?php endwhile; endif;?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment