There are a lot of WordPress plugins for adding collapse/expand in WordPress content, such as Collapse-O-Matic.
But is there a way to add automatically collapse/expand in content WordPress (single.php
)? If the content is more than 50 words, automatically the rest will be hidden.
I found the tutorial here:
http://shakenandstirredweb.com/240/jquery-moreless-text
but I can not be a way to use it. Can anyone help?
This might be old but I solve it like this as none of the answers works for me:
HTML and PHP:
CSS:
Note:
The 110px max height and 85px width might need to be changed according to your text font size.
jQuery:
This is another Variation for jQuery that I like
Option 1:
Include the post excerpt and post content, hiding the content with css.
In your css file:
Javascript/jQuery
I tried using the following code:
Result:
Text successfully cut off, but the link Readmore to expand text not working.
What do I need to improve, so to expand text link Readmore can work well.