Wordpress get_the_post_thumbnail only works for current post ID -


i'm working on creating 'related articles' feature on wordpress site. uses custom fields post author can paste links related posts displayed @ bottom of current post. want display thumbnail , link each related post.

problem: get_the_post_thumbnail works when provide id current post. have idea might going on here? here's code i'm using generate related post. i've confirmed $url, $id, , $title output expected.

    <?php $url = get_field('url_01'); ?>     <?php $id = url_to_postid($url); ?>     <?php $thumb = get_the_post_thumbnail($id, 'yarpp-thumbnail'); ?>     <?php $title = get_the_title($id); ?>      <?php echo $thumb ?>     <a href="<?php echo $url; ?>"><?php echo $title; ?></a> 


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -