Tag Info

Hot answers tagged


There are two functions you can use for this: wp_get_attachment_url to get the full sized image or wp_get_attachment_thumb_url, which gets the url of the thumbnail of that attachment. Either function takes the attachment id as the sole argument: $attachment_id= 25; //Get the full url $url = wp_get_attachment_url( $attachment_id ); //get the thumbnail ...


It seems you are using this outside the loop then use get_the_post_thumbnail to get the featured image for any post by supplying post id. So your code will become this. <?php if ( has_post_thumbnail() ) { echo '<a href="' . get_permalink( $post->ID ) . '" >'; echo get_the_post_thumbnail( $post->ID, 'my_feature_image', ...


Replace get_the_image function get_the_image( array( 'meta_key' => ... For the_post_thumbnail function: the_post_thumbnail( $size, $attr );


First, you have a typo in the provided code: an extra space between the apostrophe and the forward slash before "white-placeholder." Second, without examining the underlying logic in detail, I might try for the else statement: else { $placeholder_image = get_stylesheet_directory_uri() . '/white-placeholder-200x100.png'; return $placeholder_image; }

Only top voted, non community-wiki answers of a minimum length are eligible