- This topic has 15 replies, 2 voices, and was last updated 9 years, 6 months ago by Pilxy.
-
AuthorPosts
-
February 17, 2015 at 10:59 am #76015Pilxy
Not sure what’s going on and when this started happening, but in front of some post excerpt on blog page the word {{unknown}} appears.
Tom, can you please check to see if you can help me find a solution?
My blog page is accesible here.
Thanks!
February 17, 2015 at 11:09 am #76027PilxyMaybe just to add this:
Those words were not there at the moment the posts were published, they appeared later, but I’m not sure exactly when.
February 17, 2015 at 5:43 pm #76088TomLead DeveloperLead DeveloperThat’s weird, never seen that before.
Can you try deactivating all of your plugins and see if it’s still there?
Also check the posts themselves and remove it if you can.
February 17, 2015 at 7:01 pm #76100PilxyI 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…
February 18, 2015 at 10:55 am #76325TomLead DeveloperLead DeveloperHave you tried using the “Video” format? (look for the “Formats” metabox when adding your post).
February 18, 2015 at 11:38 am #76339PilxyI have tried, but choosing the video format does nothing, excerpt on the blog page comes out empty. You have to click on the post, to see the video, but I wan’t the video to be shown in the excerpt…
February 18, 2015 at 12:43 pm #76381TomLead DeveloperLead DeveloperCan you give this a try? http://wordpress.stackexchange.com/questions/160735/display-oembed-in-the-excerpt
February 18, 2015 at 4:57 pm #76501PilxyI have tried these
add_filter('the_excerpt', array($wp_embed, 'autoembed'), 9);
and
global $wp_embed; add_filter( 'the_excerpt', array( $wp_embed, 'autoembed' ), 9 );
But unfortunately none of them works.
February 19, 2015 at 10:39 am #76848TomLead DeveloperLead DeveloperCan you try this one:
add_filter('the_excerpt', array($GLOBALS['wp_embed'], 'autoembed'), 9);
February 20, 2015 at 6:44 am #77133PilxyNope, this one doesn’t work either.
I searched the web quite a lot yesterday and tried some other solutions too, but I didn’t have any luck…
February 20, 2015 at 11:42 am #77313TomLead DeveloperLead DeveloperInteresting – I’ll have to look into this further and maybe include it built in with a future update.
For now, try using the embed code provided by YouTube.
February 20, 2015 at 1:49 pm #77361PilxyYoutube embed code does not work either. As far as I know, wordpress strips all the codes (HTML, shortcodes, multimedia, etc.) in the excerpt and only text is shown.
It would be a great feature to have it built in the theme.
February 21, 2015 at 11:51 pm #78143TomLead DeveloperLead DeveloperI agree, I’ll look into this further ๐
February 22, 2015 at 10:52 am #78447PilxyThanks Tom, I must say I admire your outstanding support. Keep up the great work! ๐
March 2, 2015 at 5:11 pm #81988TomLead DeveloperLead DeveloperJust letting you know that in 1.2.9 you can choose the “Video” post format, and it will show full content (so oembed and youtube embeds will show up).
Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.