Toggle Full Content On Archives Only When Content Contains More Than 1 Paragraph

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 :

Related Tutorials

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.