本站为非赢利性网站,定位为个人性质的公益分享,目前内容多数是之前写的文章汇总,亦未作商业规划、运营、变现,不接受任何赞助和广告。

代码:添加了文章页底部相关文章的内容、文章页添加群信息

爱生活 zhouchao 84℃
>>欢迎光临 共同成长

添加了文章页底部相关文章的内容

<h3>相关文章</h3>
<ul class=”related_posts”>
<?php
$post_num = 8;
$exclude_id = $post->ID;
$posttags = get_the_tags(); $i = 0;
if ( $posttags ) {
$tags = ”; foreach ( $posttags as $tag ) $tags .= $tag->term_id . ‘,’;
$args = array(
‘post_status’ => ‘publish’,
‘tag__in’ => explode(‘,’, $tags),
‘post__not_in’ => explode(‘,’, $exclude_id),
‘caller_get_posts’ => 1,
‘orderby’ => ‘comment_date’,
‘posts_per_page’ => $post_num,
);
query_posts($args);
while( have_posts() ) { the_post(); ?>
<li><a rel=”bookmark” href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>” target=”_blank”><?php the_title(); ?></a></li>
<?php
$exclude_id .= ‘,’ . $post->ID; $i ++;
} wp_reset_query();
}
if ( $i < $post_num ) {
$cats = ”; foreach ( get_the_category() as $cat ) $cats .= $cat->cat_ID . ‘,’;
$args = array(
‘category__in’ => explode(‘,’, $cats),
‘post__not_in’ => explode(‘,’, $exclude_id),
‘caller_get_posts’ => 1,
‘orderby’ => ‘comment_date’,
‘posts_per_page’ => $post_num – $i
);
query_posts($args);
while( have_posts() ) { the_post(); ?>
<li><a rel=”bookmark” href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>” target=”_blank”><?php the_title(); ?></a></li>
<?php $i++;
} wp_reset_query();
}
if ( $i == 0 ) echo ‘<li>没有相关文章!</li>’;
?>
</ul>
文章页添加群信息
<strong><font color=”red”>>>关注免费活动请加Q群,个人微信号拉入(加群暗号)</font></strong><br />

转载请注明:广活生动 » 代码:添加了文章页底部相关文章的内容、文章页添加群信息

>>喜欢这篇文章,请分享、转发出去!
喜欢 (0)