php facetwp显示/隐藏标签
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php facetwp显示/隐藏标签相关的知识,希望对你有一定的参考价值。
<?php
add_action( 'wp_head', function() {
?>
<script>
(function($) {
$(function() {
FWP.hooks.addAction('facetwp/loaded', function() {
/* run code here after facetwp loaded, 100 below can be modified to set priority order */
$('.facetwp-facet').each(function() {
var facet_name = $(this).attr('data-name');
var facet_label = FWP.settings.labels[facet_name];
if ( 'undefined' !== typeof FWP.settings.num_choices[facet_name] && FWP.settings.num_choices[facet_name] > 0 && $('.facet-label[data-for="' + facet_name + '"]').length < 1 ) {
$(this).before('<h3 class="facet-label" data-for="' + facet_name + '">' + facet_label + '</h3>');
} else if ( 'undefined' !== typeof FWP.settings.num_choices[facet_name] && !FWP.settings.num_choices[facet_name] > 0 ) {
$('.facet-label[data-for="' + facet_name + '"]').remove();
}
});
}, 100 );
});
})(jQuery);
</script>
<?php
}, 100 );
以上是关于php facetwp显示/隐藏标签的主要内容,如果未能解决你的问题,请参考以下文章
php facetwp隐藏/显示地图
php facetwp bbpress删除检查隐藏主题
php facetwp修改滑块标签
php facetwp修改滑块标签
php facetwp将标签添加到类别facet
php facetwp将span添加到复选框标签