lundi 16 novembre 2015

Moved wordpress with woocommerce: get_gallery_attachment_ids() thumbs not showing

I'm attempting to move a Wordpress site (currently hosted by a foreign, difficult to deal with web development company,) to another server before they shut it down. I have access to wp-admin but no cpanel or ftp, and there are memory limitations which have prevented me from using a complete duplication/migration plugin.

Most of my regular work is HTML/CSS and I have very little experience with SQL and PHP, but I have managed to get the site copied in bits and pieces and reassembled on my local machine. It's functioning as expected except for one niggling issue I've been unable to resolve.

The woocommerce product page is displaying the main image as expected, but the product gallery thumbs are coming up empty; view image

The code which should be presenting the images is:

<!-- first image is viewable to start -->
<?php echo the_post_thumbnail(); ?> </div>
<div class="previews">
       <?php 
       $attachment_ids = $product->get_gallery_attachment_ids();
       foreach ( $attachment_ids as $attachment_id ) {
          $sql="select guid from wp_posts where ID=".$attachment_id;
          $row=mysql_fetch_object(mysql_query($sql));
       ?>
      <a data-full="<?php echo $row->guid;?>"><img src="<?php echo $row->guid;?>" width="56" height="58" /></a>
       <?php }
       ?>
        </div>

When I view the page source the img src literally is empty;

<a data-full=""><img src="" width="56" height="58" /></a>
<a data-full=""><img src="" width="56" height="58" /></a>
<a data-full=""><img src="" width="56" height="58" /></a>
<a data-full=""><img src="" width="56" height="58" /></a>
<a data-full=""><img src="" width="56" height="58" /></a>

Unfortunately I'm pretty clueless with SQL, which I'm assuming is the source of the problem? The same code works fine on the original site, which has been copied exactly (in theory) and the images that are supposed to be showing are present in the "product gallery" panel when editing the product. Adding a new image results in the same problem. Other images on the site seem to be working OK.

Any advice on what might be going on and how I might correct this error would be greatly appreciated!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire