• I made this statement especially for ensuring a thumbnail gets posted on Facebook when my links are shared but because I use a CDN the thumbnails never appear. I want to make this query without the base url so then I can just use my normal url without the CDN so I can guarantee thumbnails will work on FB.

    All helps is highly appreciated.

    # Displays post image attachment for FB (sizes: thumbnail, medium, full)
    function fb_attachment_image($postid=0, $size='thumbnail', $attributes='') {
    	if ($postid<1) $postid = get_the_ID();
    	if ($images = get_children(array(
    		'post_parent' => $postid,
    		'post_type' => 'attachment',
    		'numberposts' => 1,
    		'post_mime_type' => 'image',)))
    		foreach($images as $image) {
    			$attachment=wp_get_attachment_image_src($image->ID, $size);
    			?><?php echo $attachment[0]; ?><?php
    		}
    }

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter markey101101

    (@markey101101)

    Please anyone?

    I just want to get the image location without the base url so I get

    /wp-content/uploads/date/image.jpg

    rather than mydomain.com/wp-content/uploads/date/image.jpg

Viewing 1 replies (of 1 total)
  • The topic ‘How to remove base URL from this statement?’ is closed to new replies.