Return to Snippet

Revision: 39368
at January 17, 2011 01:42 by mommygeekology


Initial Code
// This is designed to insert custom fields only on a certain post type, a custom type
// You can remove the if line and the endif lines and just leave the DIV for reg. posts
// Or you can check for a different condition instead. 
// Note the use of get_custom_field_value, another function used to easily retrieve custom values
// Add custom meta for custom post type "calendar"

function add_calendar_meta() { // we establish a name for our function
  	if( get_post_type() == 'calendar' ) :   ?> // we check for our conditions
		<div class="entry-meta">WHEN: <?php get_custom_field_value('eventdate', true); ?> <br /> WHERE: <?php the_terms($post->ID, 'location') ?> </div> 
	<?php endif;
}
add_action('headway_after_post_title','add_calendar_meta',1); //we actually insert our html/php into the theme.

Initial URL
http://rentageekmom.com

Initial Description


Initial Title
Insert Custom Fields Meta

Initial Tags
wordpress

Initial Language
PHP