WordPress.org

Ready to get started?Download WordPress

Forums

Fancybox, adding a class to images within native Galleries, woocommerce (1 post)

  1. morgyface
    Member
    Posted 1 year ago #

    Good evening fellow wordpress developers, I trust your evening is riddled with merriment, though I write this post in the hope you will temporarily halt the fun you are having riding goats and eating soft cheese and use your expertise to very kindly assist in helping me find a solution to a problem that has halted the progress of what was a smooth running project.

    I am using Woocommerce to handle the listing and subsequent sale of products. It works swimmingly, and on product pages it uses the fancybox plug-in to display galleries of the products.

    In another section of the website, outside of woocommerce, there are other posts which also have galleries.

    I'm using the following code within single.php.

    <?php echo do_shortcode('[gallery size="medium" link="file"]'); ?>

    This means that the images attached to the posts in question are displayed using the native wordpress gallery structure. Lovely.

    In the interests of consistency I have also managed, using a function, to get the woocommmerce fancybox plugin to load on these posts despite them being outside of the woocommerce framework. I am pleased with myself for doing this and ate 12 bags of crisps in celebration.

    The problem, as I see it, is that in order for fancybox to work I need the images within the native gallery to have a class of "zoom" (and preferably a consistent rel name).

    I have searched the far corners of the interweb for a way of editing the native gallery code so that the images have this tag but alas I have not found a solution only pictures of knockers and an overweight hamster.

    I have also tried using the FancyBox Gallery plugin but find this conflicts with the woocommmerce fancybox plugin and renders it ineffective.

    Any suggestions would be gratefully received. However please be thorough in any explanations as I am not the sharpest blade in the airing cupboard. Or something.

    Thank you kindly.

Topic Closed

This topic has been closed to new replies.

About this Topic