Hello There,
Thanks for posting in! Post excerpts do not display shortcodes. You may need to do a custom code to display a custom excerpt when the use is not logged in. Because what you are trying to accomplish requires a template customization, we would highly to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.
After the child theme is set up, please add the following code in your child theme’s functions.php file
function custom_excerpt($excerpt){
if ( is_user_logged_in() ) {
$excerpt = '<i class="x-icon x-icon-lock" aria-hidden="true"></i>';
}
return $excerpt;
}
add_filter('the_excerpt', 'custom_excerpt');
We would loved to know if this has work for you. Thank you.