Forums

Trimming the Content (2 posts)

  1. dipaksaraf
    Member
    Posted 7 months ago #

    I am using the following code to display the content:

    .strip_tags(get_post($_REQUEST['WP_ID'])->post_title)."\r\n";

    Now my requirement is that i want to restrict the content to certain number of characters say 40. What additional code i need to add to the above code.

    Thanks

  2. alchymyth
    The Sweeper
    Posted 7 months ago #

    http://php.net/manual/en/function.substr.php

    example:

    .substr(strip_tags(get_post($_REQUEST['WP_ID'])->post_title),0,40)."\r\n";

Reply

You must log in to post.

About this Topic