fix: hide private parent/child orgs
This commit is contained in:
parent
8234da161e
commit
2f3ed12adf
1 changed files with 48 additions and 12 deletions
|
@ -155,13 +155,31 @@
|
||||||
<ul class="index">
|
<ul class="index">
|
||||||
<?php
|
<?php
|
||||||
foreach ( (array) $parents as $parent ) :
|
foreach ( (array) $parents as $parent ) :
|
||||||
$img_url = wp_get_attachment_image_src( $parent->image_id )[0];
|
// Filter out parents with only private roles associated.
|
||||||
$colour = get_term_meta( $parent->term_id, 'color', true );
|
$parent_args = array(
|
||||||
$colour = ( '' !== $colour ) ? $colour : 'transparent';
|
'posts_per_page' => - 1,
|
||||||
?>
|
'post_type' => 'job',
|
||||||
|
'tax_query' => array(
|
||||||
|
array(
|
||||||
|
'taxonomy' => 'company',
|
||||||
|
'field' => 'slug',
|
||||||
|
'terms' => get_term( $parent->term_id, 'company' )->slug,
|
||||||
|
'include_children' => 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$parent_jobs = new WP_Query( $parent_args );
|
||||||
|
|
||||||
<li><a href="<?php echo esc_url( get_term_link( $parent, $parent->taxonomy ) ); ?>"><?php echo wp_kses_post( get_term( $parent->term_id, 'company' )->name ); ?></a></li>
|
if ( $parent_jobs->have_posts() ) :
|
||||||
<?php endforeach; ?>
|
$img_url = wp_get_attachment_image_src( $parent->image_id )[0];
|
||||||
|
$colour = get_term_meta( $parent->term_id, 'color', true );
|
||||||
|
$colour = ( '' !== $colour ) ? $colour : 'transparent';
|
||||||
|
?>
|
||||||
|
<li><a href="<?php echo esc_url( get_term_link( $parent, $parent->taxonomy ) ); ?>"><?php echo wp_kses_post( get_term( $parent->term_id, 'company' )->name ); ?></a></li>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -185,13 +203,31 @@
|
||||||
<ul class="index">
|
<ul class="index">
|
||||||
<?php
|
<?php
|
||||||
foreach ( (array) $children as $child ) :
|
foreach ( (array) $children as $child ) :
|
||||||
$img_url = wp_get_attachment_image_src( $child->image_id, 'detail' )[0];
|
// Filter out children with only private roles associated.
|
||||||
$colour = get_term_meta( $child->term_id, 'color', true );
|
$child_args = array(
|
||||||
$colour = ( '' !== $colour ) ? $colour : 'transparent';
|
'posts_per_page' => - 1,
|
||||||
?>
|
'post_type' => 'job',
|
||||||
|
'tax_query' => array(
|
||||||
|
array(
|
||||||
|
'taxonomy' => 'company',
|
||||||
|
'field' => 'slug',
|
||||||
|
'terms' => get_term( $child->term_id, 'company' )->slug,
|
||||||
|
'include_children' => 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
$child_jobs = new WP_Query( $child_args );
|
||||||
|
|
||||||
<li><a href="<?php echo esc_url( get_term_link( $child, $child->taxonomy ) ); ?>"><?php echo wp_kses_post( get_term( $child->term_id, 'company' )->name ); ?></a></li>
|
if ( $child_jobs->have_posts() ) :
|
||||||
<?php endforeach; ?>
|
$img_url = wp_get_attachment_image_src( $child->image_id, 'detail' )[0];
|
||||||
|
$colour = get_term_meta( $child->term_id, 'color', true );
|
||||||
|
$colour = ( '' !== $colour ) ? $colour : 'transparent';
|
||||||
|
?>
|
||||||
|
<li><a href="<?php echo esc_url( get_term_link( $child, $child->taxonomy ) ); ?>"><?php echo wp_kses_post( get_term( $child->term_id, 'company' )->name ); ?></a></li>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<p>No children.</p>
|
<p>No children.</p>
|
||||||
|
|
Reference in a new issue