I found this code for elementor post widget (https://github.com/elementor/elementor/issues/5457):
add_action( 'elementor/query/my_custom_filter', function( $query ) {
// The author of the current post
$author_id = get_the_author_meta('ID');
$query->set( 'author', $author_id );
} );
I have a directory website so it’s perfect for me. I can show every listing owner’s posts on his listing page.
However if listing owner has no posts yet, it just shows just heading “User’s articles” with blank space on his listing page.
Can someone help me to add if statement for this code? Something like: If query is empty, echo “User has no articles yet”.
Thank you!
]]>Please send me a link to your site.
]]>