通过按钮/链接触发Wordpress图像库
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过按钮/链接触发Wordpress图像库相关的知识,希望对你有一定的参考价值。
我想在带有按钮或链接的灯箱中打开默认的Wordpress库,并隐藏页面上的库缩略图。我怎样才能做到这一点?
画廊短代码:[gallery ids="55,67"]
提前致谢。
答案
你可以这样试试。
<style>
.hiddengallery{
display:none;
}
</style>
<button class="showgallery" >click here</button>
<div class="hiddengallery">
// add lightbox code here
<?php echo do_shortcode('[gallery ids="55,67"]');?>
</div>
<script>
jQuery(document).on("click",".showgallery", function (){
jQuery(".hiddengallery").show();
});
</script>
以上是关于通过按钮/链接触发Wordpress图像库的主要内容,如果未能解决你的问题,请参考以下文章