Does not work this code...
function category_post_shortcode($atts){
extract(shortcode_atts(array(
'title' => '',
'link' => '',
'category' => '',
), $atts, 'category_post' ) );
$q = new WP_Query(
array( 'category' => $category, 'posts_per_page' => '3', 'post_type' => 'post')
);
$list = '<div class="latest_form_category"><h2 class="latest_form_category_title">'.$title.'</h2><a href="'.$link.'" class="latest_more_link">More</a>';
while($q->have_posts()) : $q->the_post();
$id = get_the_ID();
109 no line => $post_excerpt = get_post_meta($id, 'post_excerpt', true);
$post_thumbnail = get_the_post_thumbnail( $post->ID, 'post-thumbnail');
$list .= '
<div class="single_cat_post floatleft">
'.$post_thumbnail.'
<h3>'.get_the_title().'</h3>
<p>'.$post_excerpt.'</p>
<a href="'.get_permalink().'" class="readmore">Read More</a>
</div>
';
endwhile;
$list .= '</div>';
wp_reset_query();
return $list;
}
add_shortcode( 'category_post', 'category_post_shortcode' );
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744893144a4599534.html
评论列表(0条)