Wordpress - Custom Field


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



Copy this code and paste it in your HTML
  1. /**
  2.  * Custom Field
  3.  **/
  4. // From the current post (as string)
  5. $value = get_post_custom_values("customfield");
  6. // From the current post (as array)
  7. $values = get_post_custom_values("Thumb"); echo $values[0];
  8. // From another post
  9. $value = get_post_meta($id, "customfield", 1);
  10. // From another post (as array)
  11. $values = get_post_meta($id, "customfield", 0);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.