Hi,
I used this code found in this forum to display a layout element only when the page has a certain custom field value.
However, now the element is also applied to the search results, and the page titles are hidden as a result.
Is there a way to exclude search results to prevent this from happening?
Many thanks,
Kevin
add_filter( 'generate_block_element_display', function( $display, $element_id ) {
global $post;
if ( 17734 === $element_id && get_field('page_type') === "review") {
$display = true;
}
return $display;
}, 10, 2 );