Tag Info

New answers tagged


Lets start with your first code. If you add texts, captions etc. a shortcode will be generated: [caption] The function img_caption_shortcode() in wp-content/media.php is responsible to execute the shortcode. But this shortcode is only produced, when you use captions. Otherwise, it will be simply inserted the <a>- and <img>-Tag. who decides, what ...


hackish solution: since wordpress add a lot of classes by default to the <img>, if you don't change that behaviour by force, you can always 'inject' something via str_replace before the string class=. In code: $image = get_the_post_thumbnail( $post->ID, 'medium', array( 'class' => 'myclass' ) ); $moreattrs = 'data-fullimg= "full.jpg"'; $image ...

Top 50 recent answers are included