Support » Plugin: Amazon Link » Center Align Images in Localised Image Link Template

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author paulstuttard

    (@paulstuttard)

    Hi,

    Do you mean you want the text to wrap around the image? If so see this post for more details:

    https://wordpress.org/support/topic/cannot-find-out-how-to-make-text-wrap-around-images?replies=7

    I don’t think there is an easy way to get images to align to the centre in CSS, it is very theme specific.

    Try creating a style in your stylesheet like this:

    .centerimg {margin-left:auto; margin-right:auto;}

    Then update the image template to be surrounded by the following HTML:

    <div class="centerimg"> ... </div>

    Might work…

    Paul

    Thread Starter Deranged_Dev

    (@deranged_dev)

    Hi Paul, thanks a lot for the reply.

    If you take a look at this page:

    http://www.bbqvibes[dot]com/279/coleman-9949-750-road-trip-grill-lxe-review.html

    (Replace [dot] with “.”)

    There are two images, the first you will find is aligned to the left and I would much prefer it if it could be aligned center.

    Whenever I use the default “Localised Image” template, it automatically pushes the image to the left, it’s not a big deal just a little aesthetically displeasing.

    Anyways, building on this premise, I had a suggestion. The images added by this plugin are the main image of the product. Most products have multiple images. It would be great if we could choose which image we would like published. For example, we could choose images that show the front of the product, then the back and then the sides. I guess it would be very complicated to implement but would help greatly with product reviews.

    Plugin Author paulstuttard

    (@paulstuttard)

    Hi,

    There is an extra plugin to pull all the images… But from some recent posts it sounds like the first image pulled is not the ‘primary’ one, so can muck up normal templates that only want the main image.

    Paul

    Plugin Author paulstuttard

    (@paulstuttard)

    Okay,

    I’ve update the plugin, it should always put the ‘primary’ image as the first one, then the ‘variants’ after that:

    Download from here:

    Images Plugin V1.6

    Paul

    Plugin Author paulstuttard

    (@paulstuttard)

    It’s a bit clunky at the moment, in the template you either specify the image number with a suffix e.g. : %IMAGE%2# or use the keyword %IMAGES% to get all the images.

    Paul

    Thread Starter Deranged_Dev

    (@deranged_dev)

    I tried these but could not get it to work. I’m not technically educated.
    What I did was paste this .php file in the amazon-link plugin folder. Then I got a notification to update, which I did.

    Then I went to edit the “localized image” template and pasted %IMAGES% in the “src=%IMAGE%” thing. Basically replaced %IMAGE% with %IMAGES%. And then when that did not work, I tried replacing %IMAGE% with %IMAGES%2#. The result in both these cases was a simple text link to amazon and no images.

    I hope this makes sense. I’m a complete dolt when it comes to coding.

    Plugin Author paulstuttard

    (@paulstuttard)

    Hi,

    First things first, do you think the plugin has installed okay.

    If you go to the main WordPress ‘Installed Plugins’ page, does it include Amazon Link Extra – Images v1.6?

    If so then there are two ways to get the extra images…

    The first is if you know how many images there are (or you only want to show a fixed number of images). That is to use the %IMAGE%2# format (note IMAGE not IMAGES here). Note you can still use %IMAGE% for the primary image.

    So for example to display 2 images you would update the template as you described in your post (but without the ‘S’), the first image is image 0:

    %LINK_OPEN%<img alt="%TITLE%" title="%TITLE%" src="%IMAGE%0#" class="%IMAGE_CLASS%">%LINK_CLOSE%
    %LINK_OPEN%<img alt="%TITLE%" title="%TITLE%" src="%IMAGE%1#" class="%IMAGE_CLASS%">%LINK_CLOSE%

    If there is only one image I think the same one gets displayed twice.

    To use the %IMAGES% keyword is a bit more complicated, but once set up should be easier to use.

    In the Amazon Link > Settings page, there are two new settings: Image Array Template and Thumb Array Template.

    These have the HTML template to use for _each_ image, so for example the default is to display each image, with the index of the image:

    <div class="align left">
     %IMAGE_INDEX%:
     %LINK_OPEN%
      <img src="%IMAGE%">
     %LINK_CLOSE%
    </div>

    There is also a setting Image Array Limit that limits the number of images displayed in the IMAGES template.

    You now need to create a template to use the IMAGES keyword, this is simpler as most of the HTML is in the template we have just created so for example a template called images could contain just:

    %IMAGES%

    To force left alignment you could do something like:

    <div class='align left'>
    %IMAGES%
    </div>

    Hope this makes some sense,

    Paul

    Thread Starter Deranged_Dev

    (@deranged_dev)

    Thanks for the detailed reply.

    I tried the first method(%IMAGE%2#)format but irrespective of what number I used I got the same image (main product image). I copied the code provided by you (0# and 1#), it displayed the same image twice. I can confirm that the product selected had multiple images on Amazon.

    For the second method, I created a new template with just “%IMAGES%” in it. It did not work, gave a broken image link to amazon.

    I can also confirm that main WordPress ‘Installed Plugins’ page includes the Amazon Link Extra – Images v1.6.

    Plugin Author paulstuttard

    (@paulstuttard)

    Okay,

    One last thing to try (if you have the cache enabled), go to the settings page, the section on Caches, and try hitting the flush cache button.

    Paul

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Center Align Images in Localised Image Link Template’ is closed to new replies.