按照关键词 ‘‘百度分享按钮’’ 的文章
添加一个位置固定的百度分享按钮
HotNews Pro 2.72集成的固定在页面左侧的百度分享按钮,可方便读者分享自己喜欢的文章,本文教你把这个固定的分享按钮添加到其它主题中。
第一步,在你所用主题目录新建一个名称为:share.php的模板文件,将下面的代码复制到进去并保存:
<div id="share">
<div?class="share">
<div?id="bdshare"?class="
post_excerpt) { $description = $post->post_excerpt; } else { $description = str_replace(array("\n", "\r"), '', $post->post_content); $description = preg_replace('/\s+/', ' ', $description); $description = substr(strip_tags($description),0,220); } $keywords = ""; $tags = wp_get_post_tags($post->ID); foreach ($tags as $tag ) { $keywords = $keywords . $tag->name . ", "; } } elseif (is_category()) { $description = single_cat_title('', false); $keywords = single_cat_title('', false); } elseif (is_tag()) { $description = single_tag_title('', false); $keywords = single_tag_title('', false); } ?>