- 成品图
1.修改footer.php文件,增加如下代码,代码路径:usr/themes/Joe/public
<div class="item" id="mli" style="<?php if(Helper::options()->BaiduDomain !== 'on') echo 'display:none;' ?>">
</div>
2.修改custom.js文件,新增如下代码,代码路径:usr/themes/Joe/assets/js;如果没有该文件,请参考第3步
3.修改footer.php文件,底部增加如下代码,代码路径:usr/themes/Joe/public
<script>
// 百度收录查询
var baiduDomain = document.domain;
var url = 'https://api.uomg.com/api/entry.baidu?domain=' + baiduDomain;
$.getJSON(url,function(data){
$('#mli').append('<i class="iconfont icon-baidu">百度共收录 <strong class="">' + data.data + '</strong></i> 条');
});
</script>
4.修改usr/themes/Joe/public/custom.php 或者是 usr/themes/Joe/functions.php
// 百度收录
$BaiduDomain = new Typecho_Widget_Helper_Form_Element_Select(
'BaiduDomain',
array('off' => '关闭(默认)', 'on' => '开启'),
'off',
'是否开启百度收录查询',
'介绍:开启后,底部展示百度收录条数'
);
$BaiduDomain->setAttribute('class', 'joe_content joe_custom'); // 如果设置无法显示,将joe_custom替换成joe_other
$form->addInput($BaiduDomain);
评论 (0)