June 25, 2019 at 10:16 pm #1113396
We’ve noticed that when you use the Icon List module (or similar modules) and enter a URL for the module to use as the link, it will create HTML like this:
<a href='YOUR_URL'>Your Title< /a>
But, if you enter HTML directly into a Text Block module, it will generate HTML like this:
<a href="YOUR_URL">Your Title< /a>
If you look closely above, one uses single quotes and the other uses double quotes. This becomes an issue with how some plugins (e.g. CryptX)works, since it is looking for one or the other, but not both single and double quotes.
You don’t need a URL from me to see this behavior, just try an icon list element and add a URL with double quotes and then add a text block and add a URL and use double quotes and then look at the output.June 26, 2019 at 8:41 am #1113526
The single quotes are used within modules, if you use double quotes it would likely break the element in question.
RikardJune 26, 2019 at 5:15 pm #1113665
Maybe I don’t understand the difference between a Text Block element and an Icon List element. They both seem to be modules, so not sure why it can’t be consistent or single quotes escaped in the code to keep it all consistent? Doesn’t matter single or double, it would be nice if it was consistent. If I enter Link (single quotes in an attempt to behave like the other elements) in the Text Block and save it, it saves as Link (double quotes). Very frustrating and your answer doesn’t really explain the issue.June 28, 2019 at 11:17 am #1114196
This issue is caused that in php you can write strings within single quotes or double quotes. Using double quotes has the advantage that you can insert variables in the string which makes the code easier to read – means you have to use single quotes to enclose the value. This is also for e.g. class declaration.
Uusing single quotes is faster as the interpreter does not have to search the string for variables – therefore when you need to insert the result of a function call in the string many developers use single quotes – and then have to use double quotes to enclose the value.
GünterJune 28, 2019 at 3:11 pm #1114269
HI Günter, I agree! So why when I enter in single quotes in the Text Block element does Avia force it to double quotes? Why is it seemingly just that one element that forces double quotes? Thank you for your reply.July 4, 2019 at 10:47 pm #1115926
Some patience until Gunter can come back on this please :)
BasilisJuly 5, 2019 at 12:08 pm #1116022
This is WP default behaviour.
You can check with a standard theme.
GünterJuly 8, 2019 at 4:27 pm #1116715
OK thanks Günter. I thought the elements were part of the theme/avia framework and that would therefore control the behavior with regards to the quotes. If there’s nothing Kriesi can do (WP defaults) and the text element just operates differently than all other elements I guess we’re stuck with it.July 8, 2019 at 4:43 pm #1116724
I’m afraid – yes. Changing this behaviour is nearly impossible without rewriting WP core js files.
If you really need to limit href to either single or double quotes you can only do it by hooking in the_content filter with a very low priority (99999999) and replace it with preg_replace.
- The topic ‘Enfold HTML output inconsitencies’ is closed to new replies.