Home › Forums › Support › {{unknown}} in front of post excerpt › Reply To: {{unknown}} in front of post excerpt
February 17, 2015 at 7:01 pm
#76100
Pilxy
I figured it out. In my child theme I have altered the excerpts to show videos that are in the post. I was using this code:
/*
* show video in post excerpt
*/
function custom_wp_trim_excerpt($text) {
$raw_excerpt = $text;
if ( '' == $text ) {
$text = get_the_content(''); // Original Content
$text = strip_shortcodes($text); // Minus Shortcodes
$text = apply_filters('the_content', $text); // Filters
$text = str_replace(']]>', ']]>', $text); // Replace
$excerpt_length = apply_filters('excerpt_length', 55); // Length
$excerpt_more = apply_filters('excerpt_more', ' ' . '<a class="readmore" href="'. get_permalink() .'">»</a>');
$text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
// Use First Video as Excerpt
$postcustom = get_post_custom_keys();
if ($postcustom){
$i = 1;
foreach ($postcustom as $key){
if (strpos($key,'oembed')){
foreach (get_post_custom_values($key) as $video){
if ($i == 1){
$text = $video.$text;
}
$i++;
}
}
}
}
}
return apply_filters('wp_trim_excerpt', $text, $raw_excerpt);
}
remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'custom_wp_trim_excerpt');
When I removed this code, the words {{unknown}} dissapear.
It solved the issue, but now I have to find the other way to show those videos…