I have produced a wordpress wordpress plugin which instantly adds a <!--more--> tag for your publish according to certain criteria, but smartly places this tag within your publish. The issue is, I've not develop an effective method to fight Web coding. Presently I've it checking to ascertain if there's a <, and when so, it finds the following > within the publish.

What I am wishing to complete here's take away the html in the equation entirely. I'm wondering if there's any system, just like a git for PHP, where I'd have the ability to save the Web coding version from the string, after which strip the HTML away and keep plaintext version from the code in another variable, put the <!--more--> tag in to the plaintext version from the code, after which compare the 2 versions to correctly merge the Web coding into the plaintext.

I have attempted Google, I have done about 100 hrs of code changes, and I have still not develop an answer. Now I am bowing towards the energy from the cloud. Can there be anybody here that may develop an answer?

I've merely a very rough concept of what you are attempting to implement, so here is a very crude method of doing the work.

Rather than using the plain text individually after which doing all of the information onto it, this can be done within an "on the runInch method.

Operate a loop on all of the figures inside your publish. If you discover a < ignore ("continue") whatever comes next till you get a > so, basically you receive the plain text within the loop, that you can do all of your initial counting inside this loop (total no. of character, no. of words, etc.) - Run this loop once again and add the greater tag towards the content in line with the initial count, get out of the 2nd loop.

Written below is yet another idea, which is much more complicated and presuming that you simply can't do without obtaining the plain text.

Allow the M function as the primary string that consists of the entire publish content. Any time you look for a <tag>, push it into an assortment, recall the location of the tag in M, push that into another array.

After you have pressed all of the tags in M into an assortment together with the position of the tag, that which you have remaining is plain text. After you are done, pop back all of the tags in the array towards the plain text in line with the location. This ofcourse, needs lots of refinement, nevertheless its just a concept you are able to develop on.