Posted By

vnblancomattos on 08/07/13


Versions (?)

Wordpress - Working with custom fields

 / Published in: PHP

We set a custom field named "thumbnail" and its value to "". 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.

  1. //in our template, we put this code wherever we want the thumbail to appear
  3. <a class="myThumbClass" href="<?php the_permalink(); ?>">
  4. <img src="<?php echo get_post_meta($post->ID,'thumbnail',true); ?>">
  5. </a>

Report this snippet  

You need to login to post a comment.