Insert Custom Fields Meta


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // This is designed to insert custom fields only on a certain post type, a custom type
  2. // You can remove the if line and the endif lines and just leave the DIV for reg. posts
  3. // Or you can check for a different condition instead.
  4. // Note the use of get_custom_field_value, another function used to easily retrieve custom values
  5. // Add custom meta for custom post type "calendar"
  6.  
  7. function add_calendar_meta() { // we establish a name for our function
  8. if( get_post_type() == 'calendar' ) : ?> // we check for our conditions
  9. <div class="entry-meta">WHEN: <?php get_custom_field_value('eventdate', true); ?> <br /> WHERE: <?php the_terms($post->ID, 'location') ?> </div>
  10. <?php endif;
  11. }
  12. add_action('headway_after_post_title','add_calendar_meta',1); //we actually insert our html/php into the theme.

URL: http://rentageekmom.com

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.