[Resolved] {{unknown}} in front of post excerpt

Home Forums Support {{unknown}} in front of post excerpt

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #76015
    Pilxy

    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!

    #76027
    Pilxy

    Maybe 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.

    #76088
    Tom
    Lead Developer
    Lead Developer

    That’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.

    #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() .'">&raquo;</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…

    #76325
    Tom
    Lead Developer
    Lead Developer

    Have you tried using the “Video” format? (look for the “Formats” metabox when adding your post).

    #76339
    Pilxy

    I 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…

    #76381
    Tom
    Lead Developer
    Lead Developer
    #76501
    Pilxy

    I 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.

    #76848
    Tom
    Lead Developer
    Lead Developer

    Can you try this one:

    add_filter('the_excerpt', array($GLOBALS['wp_embed'], 'autoembed'), 9);

    #77133
    Pilxy

    Nope, 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…

    #77313
    Tom
    Lead Developer
    Lead Developer

    Interesting – 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.

    #77361
    Pilxy

    Youtube 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.

    #78143
    Tom
    Lead Developer
    Lead Developer

    I agree, I’ll look into this further 🙂

    #78447
    Pilxy

    Thanks Tom, I must say I admire your outstanding support. Keep up the great work! 🙂

    #81988
    Tom
    Lead Developer
    Lead Developer

    Just 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!

Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.