// function.php の getRecentKougabu を以下に差し替えます。 // ここから--> function getRecentKougabu($limit, $max_width, $max_width, $category = false) { global $wpdb; if($category == false) { $results = $wpdb->get_col($wpdb->prepare( "SELECT" . " ID" . " FROM" . " {$wpdb->posts}" . " WHERE" . " post_status = 'publish'" . " AND post_type = 'post'" . " AND post_password = ''" . " ORDER BY" . " post_date DESC LIMIT %d" , $limit )); } else { $results = $wpdb->get_col($wpdb->prepare( "SELECT" . " ID" . " FROM" . " {$wpdb->posts} as posts" . " , {$wpdb->term_taxonomy} as taxonomy" . " , {$wpdb->term_relationships} as relationships" . " WHERE" . " posts.ID = relationships.object_id" . " AND relationships.term_taxonomy_id = taxonomy.term_taxonomy_id" . " AND posts.post_status = 'publish'" . " AND posts.post_type = 'post'" . " AND posts.post_password = ''" . " AND taxonomy.taxonomy = 'category'" . " AND taxonomy.term_id = '%d'" . " ORDER BY" . " post_date DESC LIMIT %d" , $category , $limit )); } if(count($results) == 0) return array(); $images = kougabu_get_images(array( 'array' => true , 'post_id' => $results , 'max_width' => $max_width , 'max_height' => $max_width)); $retunrs = array(); $count = 0; foreach($results as $id) { $post = &get_post($id); $retunrs[$count]['date'] = $post->post_date; $retunrs[$count]['title'] = $post->post_title; $retunrs[$count]['excerpt'] = $post->post_excerpt; if($retunrs[$count]['excerpt'] == '') { // excerpt が設定されていない場合は 15文字抜粋 $retunrs[$count]['excerpt'] = mb_substr(strip_tags($post->post_content), 0, 15); } if(isset($images[$id])) { $retunrs[$count]['kougabu'] = $images[$id][0]; } $count++; } return $retunrs; } // <--ここまで // 追加したテーマファイルを書き換えます。
"" - "" - ...