WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Woocommerce] Product Images (11 posts)

  1. medafighterX
    Member
    Posted 1 year ago #

    Hi guys! I need help regarding the woocommerce plugin. Does anyone know how can I loop the product images as a list? Apparently, woocommerce has 2 php files for this. One is for the featured product, and one is for the product thumbnails (product-image.php & product-thumbnails.php) I'd like to put them on a single php file and loop the product images and make them appear in a list. Thanks in advance!

  2. PagePlusCA
    Member
    Posted 1 year ago #

    Would like an answer to this too, anyone?

  3. medafighterX
    Member
    Posted 1 year ago #

    Hello PagePlusCA!
    Apparently, I was able to solve this problem myself using this code:

    <ul>
    <?php
     $args = array(
       'post_type' => 'attachment',
       'numberposts' => -1,
       'post_status' => null,
       'post_parent' => $post->ID
      );
    
      $attachments = get_posts( $args );
         if ( $attachments ) {
            foreach ( $attachments as $attachment ) {
               echo '<li>';
               echo wp_get_attachment_image( $attachment->ID, 'thumbnail' );
               echo '</li>';
              }
         }
    ?>
    </ul>

    Since no one answered anyway. :|
    I'm not really a programmer but I hope this could help.

  4. PagePlusCA
    Member
    Posted 1 year ago #

    Apologies for the dumb question but did you end up combining the files and putting that code in there? Anything helps since no one has the answer, so thanks!

  5. medafighterX
    Member
    Posted 1 year ago #

    Actually, it only shows a list of product thumbnails. If you want the original size, you could replace
    echo wp_get_attachment_image( $attachment->ID, 'thumbnail' );
    to
    echo wp_get_attachment_image( $attachment->ID, 'full' );

    I only used product-image.php and removed the rest of the product-thumbnails.php

    `

  6. wontonnie
    Member
    Posted 1 year ago #

    Hi I'm having problems with getting my images on my product page to not look distorted. Can someone help me?

    Site: http://www.wealtheelifestyle.com/shop

  7. medafighterX
    Member
    Posted 1 year ago #

    Hi wontonnie! I think it has something to do with the css or the width & height of the product thumbnails of the catalog. Try checking out Settings > Catalog > Image Options and adjust the width & height. I also recommend using the regenerate thumbnails plugin after saving the settings. :)

  8. wontonnie
    Member
    Posted 1 year ago #

    Yeah I've done that countless times but every different sizes I used still makes the image blurry.. I've been using the regenerate thumbnails plugin too.

    Every time I change the thumbnail the actual thumbnail on the product page doesn't correspond to the size I've put.. I don't know what's going on!

  9. medafighterX
    Member
    Posted 1 year ago #

    How about in the Media settings? Have you tried modifying the settings there as well?
    Btw, did you uncheck the "hard crop" option?

  10. wontonnie
    Member
    Posted 1 year ago #

    No I have not. What am I suppose to in the media settings?

    Thanks for taking time to help me

  11. medafighterX
    Member
    Posted 1 year ago #

    No problem. Try adjusting the image settings there as well. And make sure you uncheck the "Crop thumbnail to exact dimensions" box.

Topic Closed

This topic has been closed to new replies.

About this Topic