• I found this code on-line as I am trying to return 140 characters for multibyte Japanese characters on a custom front page, but I am doing something wrong as it is not returning anything. I am not sure if is because strip_tags is not a defined function. Can someone please tell me what I need to get this to work? Thank you.

    front.php –

    <?php
        $recentPosts = new WP_Query();
        $recentPosts->query('showposts=5');
    ?>
    <?php while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
    
    <li><a>" rel="bookmark"><?php echo winexcerpt(140); ?></a></li>
    <?php endwhile; ?>

    functions.php –

    function winexcerpt( $length ) {
       global $post;
       $content = mb_substr(strip_tags($post->post_content),0,$length);
       return $content;
    }

  • The topic ‘multibyte custom excerpt code’ is closed to new replies.