我的简单快捷码适用于除Wordpress 2016主题中的主页(静态)之外的所有页面。除了帖子标题以外,我可以阅读的所有内容。它是空的。我想在主页上显示带有标题的帖子。一切正常。但标题为空。谢谢
//Recent post shortcode single
function mfbs_recent_post1x1($atts){
$q = new WP_Query(
array( \'orderby\' => \'date\', \'posts_per_page\' => \'4\')
);
$list = \'<div class="row mfbs1x1">\';
while($q->have_posts()) : $q->the_post();
$title = $q->the_post()->post_title;
$list .= \'<div class="small-12 medium-12 large-12 columns">\';
$list .= $title;
$list .= \'<a href="\' . get_permalink() . \'">\' ;
$list .= get_the_post_thumbnail($the_post->ID , \'medium\', array( \'class\' => \'alignleft\' ) );
$list .= \'<br>\' . get_the_title() . \'</a>\' . \'<br>\' . get_the_excerpt() . \'</div>\';
endwhile;
wp_reset_query();
return $list . \'</div>\';
}
add_shortcode(\'foodrecentpost1x1\', \'mfbs_recent_post1x1\');