Aha…I figured out the problem. I had a link in the description of the first item, and that was messing it up.
It’s hitting the “else” in the if-else statement because it’s the first image (and thus i < 1 in the encompassing for-loop). However, when it’s adding items to the array, it’s grabbing the URL of the image to grab like this:
jQuery(jQueryMatchedObj[i]).parent().parent().children().children().attr(‘href’)
Now, I don’t know where the two parent()’s are coming up form but I assume they are getting you to appropriate “gallery-item” dl. The first child gets you down to dt/dd under that (since it’s grabbing all children), and then the next child goes to the a tag (with the image link) under the dt, and the caption and description spans under the dd. It then grabs anything with an “href” attribute from those three items.
However, since I had a link in the description, it not only grabbed the href from the image a tag in the dt, but it grabed the href from the link I added to the description, and viola, it added two items at once, one of which was not a link to the image, which blew the code up.
This isn’t a fatal problem – I guess I can just put the text of the link in the description without having the actual link there (unless I can figure out a fix to temporarily go there) but I think it might be better to attempt to reference that dt a tag specifically. I certainly don’t think it would be too difficult to grab the “href” items from the dt instead of from the dl. I do think being able to put in a link into the description would be a useful thing to have.
I don’t know if this is the problem the original person was having, but this is the problem I was having.