generate_layout_element_display

generate_layout_element_display

The generate_layout_element_display allows us to bypass the Display Rules, so we can enable or disable an Element under our own conditions.

For example, if we want to assign a specific layout to Author Tom only:

add_filter( 'generate_layout_element_display', function( $display, $element_id ) {
if ( 10 === $element_id && is_author( 'Tom' ) ) {
$display = true;
}

return $display;
}, 10, 2 );

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注