<?php /* * */ add_action( 'wp_footer', function(){ if(!is_admin()) { ?> <style> img { display: block; max-width: 100%; } .lightbox { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 999999; background-color: rgba(0, 0, 0, 0.75); display: flex; justify-...
11 月, 2023
-
19 11 月
测试文章类型
I'm baby marxism bodega boys mlkshk 3 wolf moon food truck. Cred sriracha stumptown readymade put a bird on it, leggings umami pinterest thundercats Brooklyn vexillologist microdosing selvage meh. Neutral milk hotel edison bulb etsy hell of flexitarian stumptown paleo. Bodega boys gastropub lomo...
-
19 11 月
日志文章
I'm baby marxism bodega boys mlkshk 3 wolf moon food truck. Cred sriracha stumptown readymade put a bird on it, leggings umami pinterest thundercats Brooklyn vexillologist microdosing selvage meh. Neutral milk hotel edison bulb etsy hell of flexitarian stumptown paleo. Bodega boys gastropub lo...
10 月, 2023
-
7 10 月
input file字段选择图片之后怎么实现预览(还未上传到服务器的情况下)
$("#txt_image").on('change',function(){ console.log('on change'); if (this.files && this.files[0] ) { const reader = new FileReader(); reader.onload = function(e){ $("#book-image-preview").attr('src',e.target.result); } reader.r...
2 月, 2023
1 月, 2023
-
20 1 月
如何给网站添加头部可关闭的横幅广告(像justnews一样)
首先在body标签上面添加横幅的html代码,通过设置top banner的display:none 来实现 一开始网站加载时候隐藏横幅: <div id="top-banner" style="display:none ;"> <a href="#"><img src="/path/to/banner.png" alt="" style="width:100%;"></a> <button id="close-button"></button> </...
-
19 1 月
WordPress怎样检测访客是否将网站添加到收藏以及如何统计收藏数量并且展示出来
下面这段代码通过Js来检测访客是否收藏本网站: if (window.external && ('AddFavorite' in window.external)) { // 当访客将本网站添加到浏览器收藏之后下面的代码会执行 } 将收藏数量统计到数据库,我们可以使用option的api。 利用update_option来更新收藏统计的字段: $bookmark_count = get_...
-
19 1 月
WordPress文章如何添加浏览次数
在主题文件夹下面的inc文件夹(如果没有就新建一个),新建一个postviews.php文件,然后在functions.php里面引入: require get_template_directory() . '/inc/postviews.php' 然后在文件里粘贴: <?php // function to display number of posts. // 可以在后台设置一个option来决定是否开启浏览次数 func...