Return to Snippet

Revision: 64425
at August 7, 2013 16:21 by vnblancomattos


Initial Code
//in our template, we put this code wherever we want the thumbail to appear

<a class="myThumbClass" href="<?php the_permalink(); ?>">
   <img src="<?php echo get_post_meta($post->ID,'thumbnail',true); ?>">
</a>

Initial URL


Initial Description
We set a custom field named "thumbnail" and its value to "http://mydomain.com/img/img.jpg". And then we add the following code in our template where we want the thumnail to appear.

As this, we could use this code to show anything we want, not only  thumnails. Just set a key and a value different.

Initial Title
Wordpress - Working with custom fields

Initial Tags


Initial Language
PHP