get_template_part( 'global/wrap-start' ); $hubs = get_terms( array( 'taxonomy' => 'docs_hub', 'hide_empty' => false, ) ); $active_hubs_count = 0; $boxes_html = ''; if ( ! empty( $hubs ) && ! is_wp_error( $hubs ) ) { foreach ( $hubs as $hub ) { $hub_id = $hub->term_id; $matching_cats = get_terms( array( 'taxonomy' => 'docs_category', 'meta_query' => array( array( 'key' => 'documentor_associated_hubs', 'value' => $hub_id, 'compare' => '=', ), ), 'fields' => 'ids', ) ); $cat_count = ( ! empty( $matching_cats ) && ! is_wp_error( $matching_cats ) ) ? count( $matching_cats ) : 0; $tax_query = array( 'relation' => 'OR' ); if ( $cat_count > 0 ) { $tax_query[] = array( 'relation' => 'AND', array( 'taxonomy' => 'docs_category', 'field' => 'term_id', 'terms' => $matching_cats, ), array( 'relation' => 'OR', array( 'taxonomy' => 'docs_hub', 'field' => 'term_id', 'terms' => $hub_id, ), array( 'taxonomy' => 'docs_hub', 'operator' => 'NOT EXISTS', ), ), ); } $tax_query[] = array( 'relation' => 'AND', array( 'taxonomy' => 'docs_hub', 'field' => 'term_id', 'terms' => $hub_id, ), array( 'taxonomy' => 'docs_category', 'operator' => 'NOT EXISTS', ), ); $docs_query = new WP_Query( array( 'post_type' => 'docs', 'posts_per_page' => -1, 'fields' => 'ids', 'tax_query' => $tax_query, ) ); $doc_count = $docs_query->post_count; if ( 0 === $cat_count && 0 === $doc_count ) { continue; } $active_hubs_count++; $page_url = ''; $pages = get_posts( array( 'post_type' => 'page', 'post_status' => 'publish', 'posts_per_page' => 1, 'meta_query' => array( array( 'key' => '_documentor_linked_hub_id', 'value' => $hub_id, ), ), ) ); if ( ! empty( $pages ) ) { $page_url = get_permalink( $pages[0]->ID ); } else { $page_url = get_term_link( $hub ); } $cat_text = 1 === $cat_count ? '1 Category' : $cat_count . ' Categories'; $doc_text = 1 === $doc_count ? '1 Doc' : $doc_count . ' Docs'; $boxes_html .= ''; $boxes_html .= '' . esc_html( $hub->name ) . ''; $boxes_html .= '' . $cat_text . ' • ' . $doc_text . ''; $boxes_html .= ''; } } ?>
>
get_template_part( 'archive/title' ); ?> get_option( 'sidebar_show_search', 'documentor_single', true ) ) : ?>
0 ) : ?>

get_template_part( 'global/wrap-end' );