Wordpress 如何获取博客文章的特色图片、内容、上次修改日期和评论数?
我有一个wordpress网站,我想在其中创建一个博客页面,该页面将显示以下内容 博客第一行的特色形象 第二行的博客标题 第三行中的博客内容文本 最后一次更新、评论计数和发布人位于第4行。 我该怎么做 我应该直接查询数据库还是使用一些内置函数Wordpress 如何获取博客文章的特色图片、内容、上次修改日期和评论数?,wordpress,blogs,Wordpress,Blogs,我有一个wordpress网站,我想在其中创建一个博客页面,该页面将显示以下内容 博客第一行的特色形象 第二行的博客标题 第三行中的博客内容文本 最后一次更新、评论计数和发布人位于第4行。 我该怎么做 我应该直接查询数据库还是使用一些内置函数 有什么帮助吗?请将此问题移至wordpress.stackexchange.com query_posts( ); while ( have_posts() ) : the_post(); if( has_post_thu
有什么帮助吗?请将此问题移至wordpress.stackexchange.com
query_posts( );
while ( have_posts() ) : the_post();
if( has_post_thumbnail())
the_post_thumbnail( 'medium' );
else {
$photos = get_children( array('post_parent' => get_the_ID(), 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') );
if ($photos) {
$photo = array_shift($photos);
echo wp_get_attachment_image($photo->ID, 'medium' );
}
}
echo '<h2 class="entry-title"><a href="'.get_permalink().'" title="'.get_the_title().'">'.get_the_title().'</a></h2>';
the_excerpt();
endwhile;
wp_reset_query();