Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horizon Pulling Relative Image URLs #30

Open
thatdudelarry opened this issue Mar 12, 2015 · 0 comments
Open

Horizon Pulling Relative Image URLs #30

thatdudelarry opened this issue Mar 12, 2015 · 0 comments

Comments

@thatdudelarry
Copy link

I worked with your support team a couple of months ago to fix this problem. I came up with a solution and implemented it on our sites, but figured it would be worth it to share here for potentially being used in future updates.

OLD - Beginning at line 501 - classes/class-sailthru-horizon.php

// image & thumbnail
if( has_post_thumbnail( $post_object->ID ) ) {
  $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );
  $thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'concierge-thumb' );
    $post_image = $image[0];
      $horizon_tags['sailthru.image.full'] = esc_attr($post_image);
    $post_thumbnail = $thumb[0];
      $horizon_tags['sailthru.image.thumb'] = $post_thumbnail;
}

NEW - Adds $url variable and utilizes make_absolute_url to ensure absolute urls are spidered

// image & thumbnail
if( has_post_thumbnail( $post_object->ID ) ) {
  $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail' );
  $thumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'concierge-thumb' );
  $url = get_site_url();
  $post_image = $image[0];
    $horizon_tags['sailthru.image.full'] = WP_Http::make_absolute_url( esc_attr($post_image), $url );
  $post_thumbnail = $thumb[0];
    $horizon_tags['sailthru.image.thumb'] = WP_Http::make_absolute_url( $post_thumbnail, $url );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant