php facetwp替换输出上的显示值

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php facetwp替换输出上的显示值相关的知识,希望对你有一定的参考价值。

<?php
/** simple example of find and replace values in the output of a facet's html
 ** Be careful that this doesn't replace unwanted values, you may need to be more
 ** specific, such as including part of the surround html - '>Posts' to '>Articles' makes
 ** sure you target the word right after the processing <div> tag.
 **/

add_filter( 'facetwp_facet_html', function( $output, $params ) {
	if ( 'post_type' == $params['facet']['name'] ) {
		$current_values = array( 'Posts', 'Products' );
		$replace_values = array( 'Articles', 'For Sale' );
		$output = str_replace( $current_values, $replace_values, $output );
	}
	return $output;
}, 10, 2 );

以上是关于php facetwp替换输出上的显示值的主要内容,如果未能解决你的问题,请参考以下文章

php facetwp用facetwp替换genesis pager

php facetwp替换日期选择器占位符文本

php facetwp用facet sort替换woocommerce排序

php facetwp用facet的map facet替换listify map

php facetwp自动启用地图上的过滤按钮

php facetwp挂钩加载店铺上的更多按钮