Posted By

kristarella on 01/25/09


Tagged

wordpress field custom thesis thesiswp


Versions (?)

Who likes this?

8 people have marked this snippet as a favorite

goddess
girliegeek
mlangfeld
tmbrenneke
blogjunkie
joelhaus
vintagekrug
naeemnur


Custom field usage example (in Thesis function)


 / Published in: PHP
 

This shows how to add content (in this case a linked image) to the end of a post using WordPress custom fields and the Thesis theme.

  1. function add_custom_field() {
  2. global $post;
  3. if (get_post_meta($post->ID, 'key', true)) { ?>
  4. <a href="<?php echo get_post_meta($post->ID, 'key', true); ?>"><img src="<?php echo get_post_meta($post->ID, 'key', true); ?>" alt="description" /></a>
  5. <?php }
  6. }
  7. add_action('thesis_hook_after_post', 'add_custom_field', 1);

Report this snippet  

You need to login to post a comment.