Categories
Fixing Stuff Samuel

Fixing wordpress hard coded image links to work with S3

This is a follow up post to my earlier one about  setting wordpress to server images from amazon s3

 

Again please excuse the lack of polish on this, its mainly meant for my reference later.  Also shout out to my buddy Cool Brian for coming through with this little tweak:

To fix the auto trader theme from showing local image urls we altered the following file in wp-content/themes/autotrader-parent/offer-views/side-left.php

we made the following chagnes:

// alter image URL to use S3 bucket
$temp = parse_url($attachment->guid);
$new_url = “http://sprintervans.s3.amazonaws.com”.$temp[‘path’];

$slider_images[] = array(
‘id’            => $attachment->ID,
‘title’         => apply_filters(‘the_title’, $attachment->post_title),
‘order’         => $attachment->menu_order,
‘img_full’      => $new_url
);