Hi there,
so we want to check if the current post has a category term that is a child of products
.
Currently you would either need to:
a. Set each of the Post Category -> Child terms in the Element Display Rules
OR
b. Use the generate_element_display
filter hook to set element display to True if the posts are in child term
add_filter( 'generate_element_display', function( $display, $element_id ) {
/// Change 123 below to the ID of the Element we're targeting.
if ( 123 === (int) $element_id ) {
$args = array(
'include' => get_the_ID(),
'category' => 456, // Change 456 to the parent category ID we're checking for children in.
'fields' => 'ids',
);
if ( 0 < count( get_posts( $args ) ) ) {
$display = true;
}
}
return $display;
}, 10, 2 );
Note the two IDs that need changing