- A+
1:打开WordPress主题中的single.php ", $content); ID);
在single.php中找到这行代码:
2:用下面的这段代码替换Step 1中的代码
for ($i = 0; $i
if ($categories) {
echo '或许你会喜欢下面的这些文章:^_^';
echo '';
$category_ids = array();
foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
$args=array(
'category__in' => $category_ids,
'post__not_in' => array($post->ID),
'showposts'=>3, // 显示相关文章的数量
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
';
}
?>
";
} ?>
3:适当的美化一下
按照自己的主题自己美化/shui