0

我正在使用 java 目录主题,我似乎无法弄清楚这一点。在有列表列表的地图页面上(在用户按类别搜索之后)。但是,只显示第一个类别,我需要显示每个列表的所有类别。仅显示 1 个类别违背了能够按类别搜索的目的。这是代码,如果您需要其他代码来更好地理解我正在尝试做的事情,请告诉我,但我知道更改必须在此区域内。我到处寻找解决方案,这就是为什么我需要一些帮助非常感谢!

public function get_meta( $key, $default_value=false ) {
    $strOutput  = get_post_meta( $this->post_id, $key, true );
    return empty( $strOutput ) ? $default_value : $strOutput;
}

public function m( $key, $value=false ){
    return $this->get_meta( $key, $value );
}

public function get_term( $taxonomy=false, $sep=', ' )
{
    $output_terms = Array();
    if( $terms = wp_get_object_terms( $this->post_id, $taxonomy, Array( 'fields' => 'names' ) ) )
    {
        $output_terms = is_array( $terms ) ? join( $sep, $terms ) : null;
        $output_terms = trim( $output_terms );
        // $output_terms = substr( $output_terms, 0, -1 );
    }else{
        $output_terms = '';
    }
    return $output_terms;
}

public function c( $taxonomy=false, $default='',  $single=true, $sep=', ' )
{
    $strTerms   = $this->get_term( $taxonomy, $sep );

    if( $single && !empty( $strTerms  ) ) {
        $strTerms   = @explode( $sep, $strTerms );
        $strTerms   = isset( $strTerms[0] ) ? $strTerms[0] : '' ;
    }
    return empty( $strTerms ) ? $default : $strTerms;
}

public function category() {
    return $this->c(
        apply_filters( 'jvfrm_spot_' . get_class( $this ) . '_featured_tax', 'category', $this->post_id ),
        apply_filters( 'jvfrm_spot_' . get_class( $this ) . '_featured_no_tax', __( "No Category", 'javo' ), $this->post_id )
    );
}
4

0 回答 0