Tagged: ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #192374

    In Masonry, there is a field in the form for filling out the alt attribute for each img. However, the alt text is not rendered in the source code.
    Visit here: http://kriesi.at/themedemo/?theme=enfold
    Viewing the browser’s source code echoed by masonry_entries.php, the first Iphone thumbnail in the upper left corner renders this:

    <div class="av-masonry-image-container" style="background-image: url(https://kriesi.at/themes/enfold/files/2013/04/dash-iphone2.jpg);">
    <img alt="" title="" src="http://kriesi.at/themes/enfold/files/2013/04/dash-iphone2.jpg">

    Q1. Since I’m filling the alt text in the Masonry form, how do I get masonry_entries.php to render the alt text in the final HTML that’s seen in the browser? It’s not there.

    I need the alt text for numerous reasons. Site development is on localhost here, so I do not have a site online for you to visit. It is irrelevant because my code is identical to the code above.

    You have a hack that gets the “title” attribute to render in the HTML here:
    It works great.
    Q2. Can you duplicate this for the alt attribute?

    There is no function in masonry_entries.php that retrieves the alt text from what I can see. Is there another function inside another file that retrieves it. At the bottom of the URL link above, Dude indicates that the alt text is retrieved by default for the lightbox captions in Masonry. Where and how does it do that in the source code?

    Thanks for your help.


    Hi websitegurus!

    We’ll include the alt attribute in the next version. Kriesi forgot to add (and the schema.org markup) when he created the element. I went through the code and optimized it (SEO). You can download the new version of the template here: http://pastebin.com/uDMeeZZR



    Thank you so much for the code. It worked great. I edited the main file in the /enfold theme and not my child theme.
    Can you put the masonry_entries.php page in the child theme and the site will still work? This will help with updating. I reckon I could just try it and see, but I seem to recall that I tried this with another core php file and it didn’t work. Only headers, footers, function.php seem to be recognized. I am not a newbie coder, but I am pretty new to WordPress. Picking it up pretty quickly though.

    On another note, you folks should really look at the lightbox script I’m using. I’ve used it for years and know the developer pretty well. It’s far superior to the lightbox you folks are using. There are over a hundred option settings built inside and the API has built in functions that help with many things like ajax refreshes and hosting up dynamic stuff inside pages. The support is fantastic and detailed. The only other site online that I’ve seen that has similar support is yours. FYI, I have no vested interest in the script.

    For example, with your code, I’m now yanking the captions from the alt attribute in masonry, while serving up the title attribute with the mouseover option. So I can have a short caption on the thumb with a more detailed description in the lightbox window. A distinct advantage for using the alt attribute is that you don’t have the title displaying on mouseover which duplicates the mouseover effect built into masonry. It also avoids the title mouseovers built into most browsers and allows you to use javascript tooltips if you want. And, of course your alt descriptions can be very detailed which will help SEO.

    I will probably look into your backend code some more in avia.js and in some of the php files to open up more flexibility by coding in a custom data- attribute that works with the lightbox script I use. By doing so, it will allow the insertion of all sorts of lightbox display options in the headers, footers and outside the lightbox as well — HTML, videos, dynamic content, you name it. If you can code it, it can be fed to the lightbox through the data- attribute that is specific to this script. I sure wished you had a customizable data- attribute built into the backend of the wordpress manager for < a > links. I will probably have to code it myself. I can probably do it, I just don’t know where to look for all the relevant code in all your php files. It could be a lengthy trial and error process. I chatted with the developer of your third party slider that you use and he likes the idea of a configurable data- attribute by the customer. He indicated he was going to look at it in a future version release. There are numerous benefits to having this if you are a true coder.

    Anyway, these were some of the reasons I was asking for the alt attribute. You probably assumed most of the reason was for SEO.

    On a separate note, where would I find the code that renders the alt and title form fields on the backend of WordPress where you update and modify a masonry element? What file is that in? I have found the code that inserts the lightbox attributes inside of avia.js.

    Thanks again for your help. Your support in this forum is excellent. And I don’t say that lightly. I mean it.



    P.S. If Kriesi reads this forum, pass along to him that I thoroughly enjoyed his recent blog post about video games and how he parlayed some of his thoughts about video gaming into a very insightful business article that I found quite compelling, insightful, well written, enjoyable and accurate. A clever and well thought out blog post.


    BTW, we are heavily involved in simulation technologies here. Quite heavily actually.



    1) If you want to overwrite a shortcode file see: https://kriesi.at/support/topic/customize-accordion-sortable-all-tag/#post-193759
    However note that we’ll include the updated masonry_entries.php in the next update anyway and you don’t need to overwrite it.

    2) Can you provide a link to the lightbox script? I’ll look into it and if it works for us I’ll recommend it to Kriesi.



    Thanks for your input. Long weekend off here in the states, so can you leave this thread open for now until I get a chance to test it out. I won’t be able to take a gander at it until early next week. Thx.



    Ok, I’ll leave this thread open :)


Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Alt text not appearing in source code’ is closed to new replies.