这基本上是一个php问题。
add_filter( \'facetwp_map_marker_args\', function( $args, $post_id ) {
$field = get_field( \'Type\', $post_id ); // Get this post\'s ACF value
$tent = \'tent\';
if( !$field ){
$field = $tent;
}
$args[\'icon\'] = \'https://www.muddycamper.com/wp-content/themes/oceanwp-child-theme-muddy-camper/images/markers/\' . $field . \'.png\';
return $args; }, 10, 2 );
您也可以按自己的方式进行,但这需要额外的编码:
add_filter( \'facetwp_map_marker_args\', function( $args, $post_id ) {
$field = get_field( \'Type\', $post_id ); // Get this post\'s ACF value
$tent = \'tent\';
if( $field ){
$value = $field;
} else {
$value = $tent;
}
$args[\'icon\'] = \'https://www.muddycamper.com/wp-content/themes/oceanwp-child-theme-muddy-camper/images/markers/\' . $value . \'.png\';
return $args; }, 10, 2 );