The code in this tutorial extends the code in this tutorial which enables you to dynamically add a read more / read less button to archive pages. The button enables you to toggle the full content on archive pages using both slideDown & slideUp jQuery functions.
The difference is, the code in this tutorial only adds the button when the post contains 1 or more paragraphs ( at least 2 ).
Here’s the demo which shows you exactly what the code does on the front page of the Genesis Sample child theme.
Video Demo
The demo shows how the button is only added when the post contains 2 or more entries. In this example, the 1st and last 2 posts only contain 1 paragraph so the toggle button is not needed therefore not added.
Customization
You can with or without membership support :
- Use this solution on any archive type including author, blog, category, search, tag, custom post type or custom taxonomy type pages.
- Use your themes default button styling.
- Modify the Read More and Read Less button text.
- Only add the toggle button after any number of paragraphs.
- Change the speed and animation of both the slide down and slide up toggle effect.
Login or join to access the following code for members :
Was This Tutorial Helpful?