WordPress Read More jQuery

I’m building a WordPress site and wrote some code that takes overflow text from one

to another. I want my clients to be able to insert the break from the .featured div to the .overflow div on their own using WordPress’ “Read More” insert.

This just adds a comment that says into the p element. See example:

<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
   Ut enim ad minim veniam, <span>quis nostrud exercitation</span> 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.

What I want to do is use jQuery to select all the text before and after the , then I can store them in two variables and move them around where I need them.

Note: any inline HTML tags (strong,em,a,span, etc) need to be saved in those variable as well.

I’ve been messing around with $('p').text().split('');, but there’s still something I’m missing.


Read more here: WordPress Read More jQuery

Leave a Reply

Your email address will not be published. Required fields are marked *