This tutorial will guide you how to add a read more button to the WordPress tab content created by the Wonder Tabs plugin.
The Read More tag inserted into a WordPress post or page is specially handled by WordPress, it will not work in the tab content. To create a Read More button, we will need to add the button by ourselves and use JavaScript to show the extra content.
The created demo is as follows. In the first tab, you can click the Read More button to show the hidden content, and click the Read Less button to hide it. The second tab only has a Read More button.
Read More & Read Less
Read More
Wonder Tabs is the best WordPress tabs plugin to display tabbed content on your WordPress site. You can create tab content with HTML code, or create tabs from existing WordPress pages. The plugin is fully responsive and works on iPhone, iPad, Android, Firefox, Chrome, Safari, Opera, Internet Explorer and Microsoft Edge.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lacus suspendisse faucibus interdum posuere. At volutpat diam ut venenatis. Suspendisse ultrices gravida dictum fusce ut placerat orci. Enim praesent elementum facilisis leo vel fringilla est ullamcorper eget. Cras sed felis eget velit aliquet. Tristique senectus et netus et malesuada fames. Sit amet consectetur adipiscing elit ut aliquam purus sit. Massa sapien faucibus et molestie ac feugiat. Ipsum dolor sit amet consectetur adipiscing elit. A diam sollicitudin tempor id eu nisl nunc. Aliquam ut porttitor leo a diam sollicitudin tempor id. Et ligula ullamcorper malesuada proin libero. Elementum facilisis leo vel fringilla est ullamcorper eget nulla facilisi. Netus et malesuada fames ac turpis egestas sed. Tellus in hac habitasse platea dictumst vestibulum. Tristique nulla aliquet enim tortor at auctor urna. Duis at consectetur lorem donec.
Wonder Lightbox is the best WordPress lightbox plugin to display images and videos in a lightbox popup or lightbox gallery. The plugin supports images, Flash SWF movies, PDF, YouTube, Vimeo, mp4 and webm videos. It's fully responsive, works on iPhone, iPad, Android, Firefox, Chrome, Safari, Opera, Microsoft Edge, Internet Explorer and Microsoft Edge.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lacus suspendisse faucibus interdum posuere. At volutpat diam ut venenatis. Suspendisse ultrices gravida dictum fusce ut placerat orci. Enim praesent elementum facilisis leo vel fringilla est ullamcorper eget. Cras sed felis eget velit aliquet. Tristique senectus et netus et malesuada fames. Sit amet consectetur adipiscing elit ut aliquam purus sit. Massa sapien faucibus et molestie ac feugiat. Ipsum dolor sit amet consectetur adipiscing elit. A diam sollicitudin tempor id eu nisl nunc. Aliquam ut porttitor leo a diam sollicitudin tempor id. Et ligula ullamcorper malesuada proin libero. Elementum facilisis leo vel fringilla est ullamcorper eget nulla facilisi. Netus et malesuada fames ac turpis egestas sed. Tellus in hac habitasse platea dictumst vestibulum. Tristique nulla aliquet enim tortor at auctor urna. Duis at consectetur lorem donec.
There are two steps in this tutorial:
Step 1 - Add read more and read less buttons, wrap the read more content in a div class
Step 2 - Add Custom CSS and JavaScript to enable the read more function
Step 1 - Add read more and read less buttons, wrap the read more content in a div class
In this step, you can add the following code to the tab content to create a Read More button and a Read Less button. If you don't want the Read Less button, you can remove the line.
You also need to wrap the content that you want to hide into a div with class name wonder-readmore-content:
<div class="wonder-readmore-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
Step 2 - Add Custom CSS and JavaScript to enable the read more function
In the tab editor, go to the step 3 Options tab, Advanced Options, add the following code to the Custom CSS input box. The code will hide the Read Less button and the read more content by default.