SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast turkey's Avatar
    Join Date
    May 2006
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post description excerpt.

    Hello,

    I would like to get an excerpt of the text in my visual editor and put it into a template. What I have is a search results page and I would like excerpts of the description text to appear here. The code that I have is:
    Code:
    <?php echo $property['i dont know the variable']; ?>


    As stated above, I do not know what variable to put there. I can't use post_content because it will display everything on my page including the photos on it (as it should if using that code). I just want the description text.

    I tried using post_excerpt but that appears empty on the page I need my text on because I assume something isn't being called.

    editor.jpg

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2013
    Posts
    34
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Have you tried this?
    Code:
    <?php echo wp_trim_words( get_the_content(), 25, '...' ); ?>
    25 is the number of characters to be shown.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •