Posted By

shin on 10/01/12


Tagged

wp customfields cyrilic magicfields


Versions (?)

magic fields: show all fields with LABELS, not key name.


 / Published in: PHP
 

it's important for cyrilic (key name must not contain non-english symbols) or for show key names with spaces. and this code not show empty fields or fields with "name". this is not my code, i only add getlabel here.

  1. <?php
  2.  
  3. $all_meta = get_post_custom($ID);
  4. if ( $all_meta )
  5. foreach ( $all_meta as $key => $val )
  6. {
  7. if ( strpos($key, '_') === 0 ) continue;
  8. echo '<div class="specification"><span><strong>' . get_label ($key) . '</strong>: ';
  9. foreach ( $val as $val_key => $val_val ) echo $val_val . ' ';
  10. echo '</span></div>';
  11. }
  12. ?>

Report this snippet  

You need to login to post a comment.