41、文章数量更新检查模块
![图片[1] - WordPress子比主题美化教程合集【持续更新】 - 狐狸资源网](https://yk2.fenx.top/e/d7b52094480b4ba4dc364286ccb8ffe6.png)
小工具 – HTML
<div style="display: flex; align-items: center; background: #fff; padding: 10px; border-radius: 8px; height: 80px;">
<div class="ant-ai-img"><a href="https://www.emyi.cn/archive" target="_blank">
<img src="https://www.ghxi.com/wp-content/plugins/gh-ai/static/img/earth.svg" style="box-shadow:none"></a>
</div>
<div style="display: flex; align-items: center;" class="ant-ai-body">
<span style="font-size: 20px; margin-right: 20px"> 蚂蚁AI持续更新检测中</span>
<span style="font-size: 16px; margin-right: 10px">检测软件数量:<span id="tj_rzzs" style="color: red">0</span></span>
<span style="font-size: 16px; margin-right: 10px">今日更新:<span id="tj_update_24h" style="color: green">0</span></span>
</div>
</div>
<script type="text/javascript">
// 将变量值显示到对应的 HTML 元素中
document.addEventListener('DOMContentLoaded', function() {
document.getElementById('tj_rzzs').textContent = tj_rzzs;
document.getElementById('tj_update_24h').textContent = tj_update_24h;
});
</script>
<style>
/* 响应式样式(小屏幕设备) */
@media screen and (max-width: 768px) {
/* 蚂蚁AI主体布局 */
.ant-ai-body {
flex-wrap: wrap;
}
/* 蚂蚁AI图片与主体间距 */
.ant-ai-img .ant-ai-body {
margin-left: 15px;
}
/* 底部图片在移动端隐藏 */
#bottom-img {
display: none;
}
#poemContainer{
display: none;
}
}
</style>
zibll/header.php
<!--首页检测更新 -->
<script type="text/javascript">
<?php
// 获取所有文章总数
$count_posts = wp_count_posts();
$published_posts = $count_posts->publish;
// 获取要排除的分类ID列表
$excluded_category_ids = array(4, 5, ); // 多个分类ID
// 获取这些分类的文章数量
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'category__in' => $excluded_category_ids,
'fields' => 'ids',
'posts_per_page' => -1
);
$excluded_posts = new WP_Query($args);
$excluded_count = count($excluded_posts->posts);
// 计算实际要显示的文章总数
$adjusted_post_count = $published_posts - $excluded_count;
echo "var tj_rzzs=" . json_encode($adjusted_post_count);
?>
</script>
<script type="text/javascript">
<?php
/*
* 获取今日更新数量
*/
function nd_get_24h_update_count() {
global $wpdb;
$today = date('Y-m-d', current_time('timestamp'));
$tomorrow = date('Y-m-d', strtotime('+1 day', current_time('timestamp')));
$query = "
SELECT COUNT(*)
FROM $wpdb->posts
WHERE post_status = 'publish'
AND post_modified >= '$today'
AND post_modified < '$tomorrow'
";
$update_count = $wpdb->get_var($query);
return $update_count;
}
$update_24h = nd_get_24h_update_count();
echo "var tj_update_24h=" . json_encode($update_24h);
?>
</script>
42、文章页底部添加【感谢您的来访,获取更多精彩文章请收藏本站+图片。】
43、悼念模式:简单一步实现网站全局变灰教程
网站全局变灰代码如下:
body > .header,
body > .container,
body > .footer
{
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
仅首页变灰代码如下:
html .home>.header,
html .home>.container,
html .home>.footer
{
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
© 版权声明
免责声明:本站是非经营性网站,网站资源部分收集整理于互联网,其著作权归原作者所有,如果有侵犯您权利的资源,请来信告知:foxccs@163.com,我们将及时撤销相应资源。
请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
THE END





































- 最新
- 最热
只看作者