-
AuthorPosts
-
February 8, 2017 at 10:21 am #744278
Hey,
When adding a desc/title to the featured image of posts containing “, everything after the ” is not displayed in the lightbox view of the image on the site.February 9, 2017 at 6:07 am #744608February 9, 2017 at 11:09 am #744742Hey, sorry to be blunt, but that is not a solution (and of course that’s what I have done temporarily until you fix it), that’s circumventing the actual problem – there’s a problem in your code, and you need to fix it.
- This reply was modified 7 years, 10 months ago by emilbroll.
February 10, 2017 at 8:37 am #745251Hi,
If you refer to this: http://www.w3schools.com/tags/att_global_title.asp, you will see that the double quote is the start and end character of the title attribute in HTML. So what you are doing when using double quotes is to end the attribute. HTML is the base language of all web development, so I don’t think there is a way around this.
You are more than welcome to elaborate on what is wrong with out code by the way. And to be clear, the functionality you are referring to has nothing to do with our theme, it’s default WordPress functionality. So you might want submit your findings to the good people at wordpress.org instead.
Best regards,
RikardFebruary 10, 2017 at 2:26 pm #745422Hey Rikard,
I’m sorry, it’s evident that I haven’t been able to explain the issue properly.
The issue is as follows:
On single blog posts, the featured image is displayed above the title and content of the post. If you click on the featured image, a lightbox/popup pops up, displaying the full image with an image caption being displayed. This caption is usually the title of the blog post, but if you have set the alt text/description/title/caption of the image in the media library of wordpress, that content is used instead.
So: this has nothing to do with the title-attribute of the image HTML element, it is an issue of how the alt/desc/title of the image is processed before being displayed in the lightbox. I haven’t studied the code responsible for this lightbox, but it pretty obviously isn’t dealing with ” the right way, that’s what I meant by there being something wrong with your code – ALL characters can be displayed on the web, telling users to “not use this or that character” is avoiding the real problem – that the code isn’t good enough.
February 11, 2017 at 5:56 am #745685Hi,
Ok, thanks for the clarification. Could you post a screenshot of where you are filling out the information which is displayed wrong please?
is avoiding the real problem – that the code isn’t good enough
Again, you are welcome to elaborate on actual code.
Best regards,
RikardFebruary 13, 2017 at 3:21 pm #746448Here’s where the details are inserted:
https://cl.ly/3a4539222b3dThe error in your code is most likely somewhere in the /enfold/js/avia.js-file, on the lines 941-950:
image: { titleSrc: function(item){ var title = item.el.attr('title'); if(!title) title = item.el.find('img').attr('title'); if(!title) title = item.el.parent().next('.wp-caption-text').html(); if(typeof title == "undefined") return ""; return title; } },
When you’re doing
.html()
, you’re getting the raw html string – you should escape the input so it’s safe to use in a title-attribute, where it will then later be used in the lightbox – setting the title-attribute to a raw HTML-string is very bad, for obvious reasons.
What happens is, your code essentially messes up the HTML of the page, as shown in the screenshot, in cases where"
are in the image description/title.https://cl.ly/2I1Y3P0G2w3w
https://cl.ly/0y010M18032s- This reply was modified 7 years, 10 months ago by emilbroll.
February 17, 2017 at 1:23 pm #748386Hi!
Sorry for the late reply!
I tried to reproduce the issue on my end but i could not – http://imgur.com/a/HNd5i
Can you please create a testing environment and post temporary WP admin and FTP logins here privately so we can look into it?Regards,
Yigit -
AuthorPosts
- You must be logged in to reply to this topic.