Hide element on based on author role of the post

Viewed 20

What I need : (IF post is made by author is in X role, display this, else display this)

Am using elementor and Jetengine. I need to be able to hide element on a page base the query.

What am thinking is give a CSS class to element I want to hide and call that class with php. I have no idea on how to achieve this.

$current_author_roles = get_the_author_meta('roles');
if ( in_array('Adminstrator', $current_author_roles) ) {
}

CLASS:

<style> 
.hidden{ 
    display:block; 
} 
.hidden{ 
    display:none; 
} 
.shown{ 
    display: block !important; 
} 
</style>
0 Answers
Related