WordPress.org

Ready to get started?Download WordPress

Forums

How to trim post (2 posts)

  1. mshuong
    Member
    Posted 3 years ago #

    Dear friend
    Please help me to trim a post (about 200word) ,
    this code for post :
    <?php echo $post->post_content; ?>

    Please help me
    Thanks
    http://vietnam-cambodiatravel.com/
    "Vietnam has exerted itself to be a favorite destination of more and more tourists. There’s a Hanoi elegant with friendly people, a Sapa with colourful-dressed minorities, a Halong Bay with amazing caves listed on UNESCO World Heritage. There’s a Hue romantic with palace and rain, a tranquil Hoi An where you can have clothes made in one day, a Danang dynamic by Han river. There’s a Nha Trang with best bays of the world, a Saigon busy and modern like Newyork, a Mekong-delta with fascinating floating market......"

  2. Domino_ukraine
    Member
    Posted 3 years ago #

    Well, somehow (i'm not play with this - just for instance):
    preg_replace ('/(( \ w + \ W *) {199} (\ w +))(.*)/', '$ {1} ', $ post-> post_content);

    199 - number of words (start from 0)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.