Quotes no longer showing
-
this code:
[content field=”pgn”]
used to yield output from my field like this:
[Event “Live Chess”]
but now instead of that it yields:
[Event &#-8220;Live Chess&#-8221;]
(note that I inserted dashes here to make the problem display for you)As I’m trying then to pass that to another plugin via shortcode it doesn’t work anymore (it did until just a bit ago). What has happened to change this and how can I fix it? Thanks, Eliot.
Bob
-
Hmm, I tested this and I’m not seeing the issue.
“and”are left and right double curly quotes. That looks like the field value is being formatted, I believe by the wp_texturize filter. Have you looked in the field settings for the plugin you’re using to create/save the field?Or..if you actually entered curly quotes in the field, then it’s just being HTML escaped – I wonder what is causing that. It could be related to the changes in WP 4.2.3. – but since I’m not seeing it, it seems to be specific to your setup – other plugins, or maybe surrounding context of how you’re using the shortcode.
In the newest plugin update, I added two parameters to escape/unescape HTML special characters. So, you should be able to display the field correctly like this:
[field pgn unescape=true]Well, this code snippet is working:
[pgn]
[content field=”pgn”]
[/pgn]But this code snippet used to work but all of a sudden doesn’t:
[pgn]
[–loop type=”topic” parent=this orderby=title field=topic_type value=”1″]
[content field=”pgn”]
[/–loop]
[/pgn]The second example is within a set of nested loops and involves also tabs and spoilers using Ultimate Shortcodes.
When I look at the page source I can see that in the first instance the quotes are handled normally, but in the second instance I see what you are calling HTML escaped. This must be a result of 4.2.3, but I’m clueless as to why or how to fix it.
Hmm..in that case, maybe the new parameter will not work. Could you try it and see how it works for the second use case?
I saw that after WP 4.2.3, people were having difficulty with nested loops and/or quoted shortcode parameters. So that’s another thing you could try, to remove quotes like this:
[pgn] [--loop type=topic parent=this orderby=title field=topic_type value=1] [field pgn] [/--loop] [/pgn]I saw this is using
[--loop]. Wow, are you really using a loop inside a loop inside a loop? Hard to imagine how that’s structured, but I’m glad the nested loop feature has been useful. 🙂Yes, I am using a loop inside of a loop inside of a loop. Here is the page: http://slowchessleague.org/current-tournaments-status/
I have temporarily made it available to non-members so that you can see it.
If you are familiar with chess, the problem is the game viewers in the top section. They used to display the games fine but now don’t. But they work elsewhere on the site without the nesting as with the first example above.
I tried the unescape parameter and removing the quotes, but that doesn’t seem to solve the problem.
I have also noticed on that page that a nested shortcode from another plugin (Shortcodes Ultimate) is also busted here that was working and that works elsewhere that it isn’t nested. So perhaps there’s more afoot here. But still almost certainly related to 4.2.3 as I don’t think that plugin has updated for awhile.
To investigate further, can you try it without
[pgn]..[/pgn]to see if the field value is HTML escaped (like & #8220;)? If not, then I believe it’s happening when[pgn]is running the shortcodes inside it.Well, when I remove the pgn wrapper I can see the quotes displayed on the page, but when I view the page source I can see that they are still HTML escaped, not like in the first code example that is working.
OK, another try – with the newest plugin update, can you add unescape=true to the loop?
I guess that I got bleary-eyed last night and was trying a noescape parameter instead of unescape. However, after fixing that this afternoon it still hasn’t helped with the problem. In fact, if I add the unescape parameter to each of the loops in the nest it causes other problems (breaks the nesting). Using it with field doesn’t break anything else, but also does not fix things. It just feels like I’m probably missing something fairly straight-forward here somehow.
Hello, could you try the newest plugin update to see if that solved the issue?
That does indeed seem to address the main issue with my game viewers not working! Now the HTML escape problem seems under control. However, a few issues still persist, so I’m working on that. It seems that field and content aren’t working precisely the same way within the loop that they were before. And this does also involve another plugin so I’ve got a bit of work to do to narrow down what’s really the problem. But basically, in some circumstances neither field nor content yields data that comes from the record being looped. This may be aggravated by the fact that I’ve used a custom field called ‘title’ in a forum (which is what is being looped) and so sometimes it’s using the field that I’ve also called ‘title’ being accessed from another item within a nested loop. Looking back I might not have used a custom field name that is often used elsewhere as a predefined field, but hindsight is always 20/20.
Thanks so much for your diligent work on this, Eliot!!!
I’ve now resolved the remaining issues (which seem to be the fault of the other plugin) by using the pass function as I have done before. I think I am good to go for now! Thanks, Eliot! You rock, my friend.
The topic ‘Quotes no longer showing’ is closed to new replies.