【WordPress教程】wordpress美化 – 美观的文章页底部版权声明

如果自己的文章写的很棒,别人看到了想转载,但是又不知道你能不能同意,这个时候就有点麻烦了。这次带来的wordpress美化教程就可以在你的文章底部添加一些有趣的信息,给你的网站访客展现更多有趣的内容,例如转载声明或是加群链接。

效果演示:Demo

效果如下:

实现方法

将以下代码添加至主题根目录的functions.php文件<?php下,然后根据代码中的提示换上自己需要的内容以及图片即可。

//在所有文章底部添加自定义内容
function add_after_post_content($content) {
        if(!is_feed() && !is_home() && is_singular() && is_main_query()) {
                $content .= '
<style>
.hh_wenzhangjieshu{padding:30px 0;text-align: center;border-top: double rgba(70, 139, 230, 0.14);}
.hh_wenzhangjieshu img{border:0;text-align:center;box-shadow:none;}
.hh_content_footer{width:100%;height:200px;box-shadow: 0 0px 1px #d9e0eae3;margin-top:0px}
.hh_content_footer .item_top_left{padding:20px;float:left;}
.hh_content_footer .item_top_left p{line-height:14px;font-weight:600;font-size:12px;padding-left: 7px;}
.hh_content_footer .item_top_left h3{color:#f7516c;font-size:18px;font-weight:600;}
.hh_content_footer .item_top_right{float:right;padding: 20px 50px 20px 20px;}
.hh_content_footer .item_top_right .hh_erweima{width:80px;height:80px;background:#f7f7f7;float:left;margin-right:15px;margin-top:15px;padding: 6px;}
.hh_content_footer .item_top_right .hh_qqqun{float:left;margin-left: 20px;}
.hh_content_footer .item_top_right .hh_qqqun img{width: 80px;height: 80px;margin: 0 51px 0 0;float: left;}
.hh_content_footer .item_top_right .hh_qqqun .spanQ1{background:#f4f8ff;}
.hh_content_footer .item_top_right .hh_qqqun .spanQ3{margin: 20px 0 10px;}
.hh_content_footer .item_top_right .hh_qqqun .spanQ2{margin: 10px 0 0;}
.hh_content_footer .item_top_right .hh_qqqun a{display:block;background:#f4f8ff;line-height:30px;border-radius: 15px;margin-top:15px;text-align:center}
.hh_content_footer .item_top{width:100%;height:118px;}
.hh_content_footer .item_bottom {width:100%;float: right;}
.hh_content_footer .item_bottom .item_bottom_left{float:left;margin-left: 27px;}
.hh_content_footer .item_bottom .item_bottom_left a{float:left;text-align: center;padding: 7px 20px;display:block;margin-right:20px;color:#fff;font-weight:600;border-radius: 4px;position: relative;top:-5px;}
.hh_content_footer .item_bottom .item_bottom_right{float:right;font-weight:600;color:#666;margin-right: 44px;}
.hh_content_footer .item_bottom:before{width:100%;height:1px;background: #e6f0ff;display:block;margin-bottom: 20px;}
.hh_content_footer .hh_button_jianbian01{background:linear-gradient(to left,#70a4fe,#4583ec)}
.hh_content_footer .hh_button_jianbian02{background:linear-gradient(to left,#fe9369,#f7516c)}
.hh_content_footer .hh_button_jianbian03{background:linear-gradient(to left,#c867ff,#8a92fb)}
.hh_content_footer .hh_button_jianbian01:hover{background:linear-gradient(to left,#4583ec,#70a4fe)}
.hh_content_footer .hh_button_jianbian02:hover{background:linear-gradient(to left,#f7516c,#fe9369)}
.hh_content_footer .hh_button_jianbian03:hover{background:linear-gradient(to left,#8a92fb,#c867ff)}
@media (max-width:767px){
  .hh_content_footer{height:360px;}
  .hh_content_footer .item_top_right{float: none;position: relative;top: -23px;}
  .hh_content_footer .item_bottom{margin-top:30px}
  .hh_content_footer .item_bottom .item_bottom_right{float:none;margin-top: 61px;text-align: center;}
}
.hh_qqqun a img{position: relative;top: 7px;right: 2px;}
</style>

        <div style="text-align: center;" class="hh_wenzhangjieshu"><img src="图片URL"/></div>
        <div class="hh_content_footer">
        <div class="item_top">
        <div class="item_top_left">
        <h3>【银河舰队】温馨提醒:</h3>
        <p>本站所有文章都可以进行提问,有问必答,欢迎骚扰!</p>
        <p>如果您喜欢我们,请收藏本站,您将得到更好的服务。 如有侵权请邮件与我们联系处理。 </p>
        </div>
        <div class="item_top_right"><div class="hh_qqqun">
            <br>
            <img src="图片URL">
            <!-- <span class="spanQ1 spanQ3">QQ交流群</span>
            <br> 
            <span class="spanQ1 spanQ2">QQ交流群</span> -->
        </div></div>
        </div>
        <div class="item_bottom">
        <div class="item_bottom_left">
        <a href="/bubble" class="hh_button_jianbian01" target="_blank">投诉建议</a>
        <a href="/vips" class="hh_button_jianbian02" target="_blank">购买会员</a>
        <a href="/shop" class="hh_button_jianbian03" target="_blank">服务商城</a>
        </div>
        <div class="item_bottom_right">
        © 转载请联系作者,私自转载视为侵权!
        </div>
        </div>
        </div>';
        }
        return $content;
}
add_filter('the_content', 'add_after_post_content');

给TA打赏
共{{data.count}}人
人已打赏
WordPress主题

【WordPress主题】Cosy3.1.3 超强自定义DIY布局实力派WP主题漂亮得不像话

2020-3-21 1:17:00

WordPress教程

【WordPress教程】解决升级 WordPress时提示”另一更新正在进行”

2020-4-1 12:50:37

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索