Skip to:
Content
Pages
Categories
Search
Top
Bottom

Getting First 100 Characters of the Post Content

  • Profile photo 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)
  • Profile photo of Boone Gorges
    Boone Gorges
    Keymaster

    @boonebgorges

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

    Profile photo of chetbrz
    chetbrz
    Member

    @chetbrz

    Nice…
    Thank you for the help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting First 100 Characters of the Post Content’ is closed to new replies.
Skip to toolbar