Archived topic
select post format for element visualization rules
3 replies · Started by Roberto on August 23, 2021
Viewing posts 1–4 of 4
i would show an element only in the post with a specific post format.
How can i do?
Hi there,
You can use this filter:
https://docs.generatepress.com/article/generate_element_display/
For example:
add_filter( 'generate_element_display', function( $display, $element_id ) {
if ( 100 === $element_id && 'image' === get_post_format() ) {
$display = true;
}
return $display;
}, 10, 2 );
Make sure to replace 100 with the actual element ID and image with the post format you want.
Adding PHP: https://docs.generatepress.com/article/adding-php/
Perfect. Thanks Leo.
No problem :)
This archived topic is closed to new replies.