Tag Info

Hot answers tagged

2

I think your code is very close, try to use wp_get_attachment_image_src() instead: function thumb_medium( $atts, $content = null ) { // return wp_get_attachment_url( get_post_thumbnail_id( $post_id, 'medium') ); global $post; $thumb_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium' )[0]; if ($thumb_url) { ...


1

Have you seen this ? http://stackoverflow.com/a/28429009/3967385 Actually you can't fire JavaScript with php simply like that.



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