wp 次の記事へに画像、サムネイルを表示させる

            <div class="detail_bottom">
	            
	            
<?php
$prevpost = get_adjacent_post(false, '', true); //前の記事
$nextpost = get_adjacent_post(false, '', false); //次の記事
if( $prevpost or $nextpost ){ //前の記事、次の記事いずれか存在しているとき
	if ( $prevpost ) { //前の記事が存在しているとき
		if (has_post_thumbnail() )	{
			$image_url = wp_get_attachment_image_src(get_post_thumbnail_id($prevpost->ID), 'medium');
		}
	    echo '<div class="detail_link_left"><a href="' . get_permalink($prevpost->ID) . '"><div class="link_img"><img src="' . $image_url[0] .' "></div><p>'; echo get_the_title($prevpost->ID); echo '</p></div></a>'; 
	 } 
	
	if ( $nextpost ) { //次の記事が存在しているとき
		if (has_post_thumbnail() )	{
			$image_url = wp_get_attachment_image_src(get_post_thumbnail_id($nextpost->ID), 'medium');
		}
	    echo '<div class="detail_link_right"><a href="' . get_permalink($nextpost->ID) . '"><div class="link_img"><img src="' . $image_url[0] .' "></div><p>'; echo get_the_title($nextpost->ID); echo '</p></div></a>';
	}
}
 ?> 
                
            </div>