Use a variable inside get_post_thumbnail
-
I have custom post types, with custom meta fields.
Used in a loop to list features on my homepage.Within the loop, I want to use a variable ($number) from one of my meta fields, to pull the feature image from a different post.
EG: This works of course, getting the image from post no. 3778 :
<?php echo get_the_post_thumbnail( 3778 , 'thumbnail' ); ?>
but I need the number to be my variable, such as:
<?php echo get_the_post_thumbnail( $number , 'thumbnail' ); ?>
I’ve been at this for 2 days now… PLEASE HELP?!
- The topic ‘Use a variable inside get_post_thumbnail’ is closed to new replies.