How to filter wp_list_categories output with some custom post type meta query?


I wonder, is it possible to achieve this?

..or the only way is that i need to build a custom Query with tax_query and meta_query (+ all the custom html output logic, etc.) for it to ‘mimic’ what i would try to do as written in this question’s title?

Important: i need it to work not only on the taxonomy archive pages, but as secondary queries as well. (e.g. widgets, etc.)

in other words, how can i make this filtered somehow.. by specific CPT’s meta_query?

function hungarian_locations_tag_cloud(){
        $args = array(
        'echo'         => false,
        'taxonomy'     => 'helyszinek',
        'orderby'      => 'name',
        'show_count'   => false,
        'pad_counts'   => false,
        'hide_empty'   => false,
        'hierarchical' => true,
        'depth'        => '1',
        'title_li'     => '',
        'child_of'     => '11' // Hungary
    $lista = '<ul class="helyszin-tagek magyarorszag">';
    $lista .= wp_list_categories( $args );
    $lista .= '</ul>';

    return $lista;
    // a link-kepzest az add_category_parent_css - funkcio vegzi
add_shortcode( 'hungarian_locations', 'hungarian_locations_tag_cloud' );

I just would love to save some dev time + keep the code simple, if there is any smart solution on this. Cheers!

Viktor Boritas 8 months 2020-12-08T16:10:31-05:00 0 Answers 7 views 0

Leave an answer