If you have troubles since the update to WordPress 4.5 please read this post before opening a new thread.
June 5, 2012 at 11:24 am #13037
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.
PetrJune 6, 2012 at 9:47 am #77561
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:
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.
PetrJune 6, 2012 at 5:50 pm #77562
The topic ‘Possibility of adding a tag to every image in 'Products' element’ is closed to new replies.