I am working on a simple user profile archive, using the theme "Atomic Blocks" as a starter theme. I am using one custom post type and several custom post fields to create these user profiles. The Custom Post type "Profile" and the plugin Advanced Custom Fields (ACF) to display different content on each "post" to look like a profile of sorts (a profile picutre, a file download, a video embed and short description).
Now I want to add more custom fields to these custom post type excerpts (see below). Mainly the profile pictures.,
I managed to create a custom excerpt that displays the profile description ("Profilbeschreibung" in the image above) custom field with this code:
function advanced_custom_field_excerpt() {
global $post;
$text = get_field('profilbeschreibung');
if ( '' != $text ) {
$text = strip_shortcodes( $text );
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$excerpt_length =30; // 30 words
$excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
}
return apply_filters('the_excerpt', $text);
}
Since I am not that experienced with creating custom wordpress functions I am stuck. My main question would be: Is there any way to achieve displaying a custom field containing an image in each profile excerpt?
I know that excerpts have a hard time displaying html, so I am not sure.
I looked all over and found nothing for my specific case. I appreciate any insight into what I might have to do or what went wrong. Thanks!