wordpress 文章点击图片放大
blog
本文字数:154 字 | 阅读时长 ≈ 1 min

wordpress 文章点击图片放大

blog
本文字数:154 字 | 阅读时长 ≈ 1 min

1.下载 auto-highslide 插件

auto-highslide 下载,提取码:psf0

2.将下载的插件上传到 wordpress

在 wordpress 界面点击“插件”-“安装插件”-“上传插件”,将压缩包上传安装即可

3.在 head.php 中添加部分代码

在服务器的文件管理器中,进入到 public_html/wp-content/themes/your_theme/header.php 文件,在 </head> 前加上如下代码

<script type="text/javascript">
jQuery(document).ready(function($){
 
$('.entry-content img,.entry-featured img').each(function(i){
if (! this.parentNode.href) {
$(this).wrap("<a href='"+this.src+"' class='highslide-image' onclick='return hs.expand(this);'></a>");
}
});
});
</script>
8月 21, 2024
10月 30, 2021