Posted By

mommygeekology on 01/17/11


Tagged

wordpress fields hooks custom headwaytheme


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


aanoojgmailcom


Insert Custom Fields Meta


 / Published in: PHP
 

URL: http://rentageekmom.com

  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.

Report this snippet  

You need to login to post a comment.