2012-01-24 6 views
0

私は次のものを表示するブログページを作成したいワードプレスサイトを持っています。 ブログ投稿のおすすめ画像、コンテンツ、最終更新日、コメント数を取得するにはどうすればいいですか?

  1. 最初の行にあるブログの紹介画像
  2. 内で投稿
  3. 最後の更新は、コメントがカウント三行目の2行目
  4. ブログのコンテンツ(テキスト)でのブログのタイトルと4行目。

どうすればよいですか?

私はデータベースに直接問い合わせるか、組み込み関数を使用していますか?

助けが必要ですか?

+0

この質問をwordpress.stackexchange.comに移動してください – amolv

答えて

0
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(); 
関連する問題