0

I use a plugin on my blog that allows the user to click on an image to enlarge it in a pop-up window. My plugin of choice for this task is the FancyBox for WordPress plugin.

Most of the time the plugin works as expected. However, I have discovered that it doesn't function on images found on the front page of my blog if the image is part of a post which contains the <!--more--> quicktag. For posts without the <!--more--> quicktag the FancyBox functionality is working as expected.

Also, on the corresponding single-post page of a post with the <!--more--> quick tag, the FancyBox functionality is working as expected. This makes sense since (I believe) the <!--more--> quicktag is completely ignored on single-post pages.

I can see from examining the HTML page source that the class="fancybox" and rel="fancybox" attributes are missing from the images' <a> tags on the problem posts. I know that the plugin normally inserts these attributes. But I don't understand why the attributes are not inserted when the <!--more--> quicktag is utilized.

I'm using a custom theme but I have tried a couple of other generic themes and it didn't seem to help. I have also tried two other FancyBox plugins (Easy FancyBox and Fancybox) and they both exhibited the problem.

My site is http://www.untamedimages.com/blog

I'm a bit of a noob when it comes to php and WordPress coding and I don't really know where to start troubleshooting this problem. I'm happy to provide any additional information if that would help lead to a solution.

Any help would be greatly appreciated.

  • I discovered the source of the trouble I was having and it turns out that it was two misplaced "/" characters in each and every one of my post's html. The extras slashes were being inserted by a 3rd party template. In light of this fact, is there some way to delete my original question? Or, at a minimum, is there some way I can mark it as closed? – PowerMove Nov 11 '13 at 17:40
1

Your images aren't being encapsulated by the hyperlink markup, so unless you're using additional calls, Fancybox won't know which hyperlinks/images to Fancybox.

You'll either need to fix this in the template loop that your homepage uses, or add some hacky additional call like:

jQuery('.post .imgpost').on('click', function($) {
    $.fancybox();
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.