0

I am a newbie. Figured out how to show property descriptions on property preview pages, but I want to only show a portion of the description, to cut it off and add to be continued dots ...

Few questions:

  1. Is this the best way to display a property description?
  2. How do you shorten the amount of text displayed?
  3. How do you add the dots at the end?

This successfully displays the property description, however, I don't know where to start in shortening it and adding dots.

catcon
  • 1,295
  • 1
  • 9
  • 18
Rally
  • 1
  • 2
  • 2
    1) It depends on how you design your website, we can't tell it is the best or not. 2) use `substr($yourstring, $star_position, $end_position)` function. 3) Simple concatenation is enough – catcon Jul 13 '19 at 03:49
  • @catcon Thank you. This worked echo substr (get_the_content(), 0, 100). ("..."); – Rally Jul 13 '19 at 05:31
  • 2
    Possible duplicate of [PHP/jQuery Shorten string and show more on click](https://stackoverflow.com/questions/20637641/php-jquery-shorten-string-and-show-more-on-click) – Masoud Keshavarz Jul 13 '19 at 05:57

0 Answers0