Return to Snippet

Revision: 11120
at March 18, 2009 06:29 by kristarella


Updated Code
function add_custom_field() {
global $post;
   if (get_post_meta($post->ID, 'key', true)) { ?>
      <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>
<?php   }
}
add_action('thesis_hook_after_post', 'add_custom_field', 1);

Revision: 11119
at January 25, 2009 19:00 by kristarella


Initial Code
function add_custom_field() {
global $post;
   if (get_post_meta($post->ID, 'key', true)) { ?>
      <a href="<?php echo get_post_meta($post->ID, 'key', true); ?>"><img src="<?php echo get_post_meta($post->ID, 'key', true); ?>" alt="map" /></a>
<?php   }
}
add_action('thesis_hook_after_post', 'add_custom_field', 1);

Initial URL


Initial Description
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.

Initial Title
Custom field usage example (in Thesis function)

Initial Tags
wordpress

Initial Language
PHP