分类组合为空时隐藏分类

时间:2019-03-21 16:51:04

标签: php wordpress

当前,每个分类法均设置为hide_empty=1

但这将每个分类法视为一个个体,我需要隐藏所有空白的组合。

任何见识将不胜感激。

$practitioner_terms = get_terms( 'pa_collection', 'orderby=count&hide_empty=1&order=DESC' );

$practitioner_termss = get_terms( 'product_tag', 'orderby=count&hide_empty=1&order=DESC' );

当前网址设置

https://*****.com/collection/%COLLECTION-TERM%/product-tag/%PRODUCT-TAG-TERM%

// Generate terms URLs
$practitioner_terms = get_terms( 'pa_collection', 'orderby=count&hide_empty=1&order=DESC' );
$practitioner_termss = get_terms( 'product_tag', 'orderby=count&hide_empty=1&order=DESC' );

if( !empty( $practitioner_terms ) ){
    $pri = 1;
    $chf = 'weekly';
    foreach ($practitioner_terms as $key => $term ){
        foreach ($practitioner_termss as $key => $terms ){
        $url = array();
        $url['loc'] = site_url().'/collection/'.$term->slug.'/product-tag/'.$terms->slug;

            $output .= $wpseo_sitemaps->sitemap_url( $url );

    }

    }

}

0 个答案:

没有答案