Skip to:
Content
Pages
Categories
Search
Top
Bottom

Getting First 100 Characters of the Post Content

  • Avatar of chetbrz
    chetbrz
    Member

    @chetbrz

    I am trying to get the first 100 characters of a topic post.
    So far I have this code:

    $shortcontent=substr(bp_the_topic_post_content(), 0, 100);

    But that is echoing the full post content wherever I have that code.
    (Showing the full post twice)

    Can anyone help me with this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

    `bp_the_topic_post_content()` is the echo function. Use `bp_get_the_topic_post_content()` instead.

    Avatar of chetbrz
    chetbrz
    Member

    @chetbrz

    Nice…
    Thank you for the help.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.