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


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

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 get_label here.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.