Reply To: Description (content) character counts include non-diplayed characters

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Description (content) character counts include non-diplayed characters Reply To: Description (content) character counts include non-diplayed characters

#8876

Ernest Marcinko
Keymaster

Hi!

I've given this one quite a lot of thought, but once it comes to HTML tags and non-readable characters it's very difficult to put together a good solution.

– While it would be actually possible to distinguish a set of non-readable charaters from others (including persian and other languages), there is no way of measuring the length of the actualy HTML tags, which can and do contain alphanumeric characters. The calculation then would only exclude the special ones, but it's a relatatively small portion compared to the actual HTML tags and all of their attribues (like href, style, classes etc..)

– A different approach perhaps is to clear the text from HTML and measure it's length, and somehow find the last words in the original with the closing HTML tags. In this case however after stripping the tags, there is no information left on their positions, meaning it's almost impossible to find the corresponding part in the original, with the desired HTML tags.

I've done some research if there is already a smart way of calculating text only, but leaving desired HTML in tact, but I could not find anything reliable I could implement or start off with.

The best workaround I can think of in this situation is to create a custom field to be used as the description and store the desired description text there. In that case you can increase the count to a very high number to never reach the end, like 700 or so. On the Advanced Options panel then you can choose that custom field as the primary description field.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)