Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13037

    Hello team,

    I would like to have a kind of a sticker added to images in your ‘Products’ dynamic template element. I thought that a <span> tag that could be addressed and given some content via css could do the job – I managed to do the thing on the sigle product overview page – you can see it here: http://www.magsbags.cz/?product=svacinovy-ubrousek-fialovy-puntik – it’s the ‘Novinka’ circle sticker placed on top of the product image thumbnail. I’d like to do the same with the product carousel on our homepage, but I could not find the place in the code where this element is created. Could someone give me a clue whether this idea is practicable and if so, where to look for the code?

    Thanks a lot for any answer in advance.

    Petr

    #77561

    Hi,

    I just managed to solve this issue. Just to give this topic some reason to exist:

    the place the images thumbnails are created is in media.php file included in the wordpress wp-includes directory, the function is called wp_get_attachment_image. At the end of the function there is a following row:

    $html .= ‘/>';

    which I changed to:

    $html .= ‘/><span class=”nts-img1″ title=”‘ . get_the_title( get_post_thumbnail_id() ) . ‘”></span>';

    That adds an empty span to the image, which is considered to be a dirty way to solve problems by some more advanced coders, but I’m just a mere beginner with almost none experience so far, so this solution is good for me at this moment :-)

    Then I address the span in the custom.css file included in your Abundance theme css folder as follows:

    .nts-img1[title~=”novinka”]

    where nts-img1 is the class of the span. As you can see, you have to include some string in the image title, because the image title is passed to the span title as well and it is then addressed following this string in the css part. This way, you can have several kinds of ‘stickers’. It’s not the cleanest way, I know, I would like to add the spans to the images according to tags or categories of the products, but I need to gain some experience before as I have very limited knowledge of php. This was only very quick solution.

    Sorry for messing up your support forum, as this issue touches more WordPress than Abundance theme.

    Petr

    #77562

    Hi Petr,

    Thanks for posting your resolution. While I definitely don’t recommend modifying the wordpress files it seems to have done the trick.

    Regards,

    Devin

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Possibility of adding a tag to every image in 'Products' element’ is closed to new replies.