Skip to content

Instantly share code, notes, and snippets.

@danielpataki
Last active April 14, 2016 17:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielpataki/bc905e7fcb714f0a03c40941a82e1d5b to your computer and use it in GitHub Desktop.
Save danielpataki/bc905e7fcb714f0a03c40941a82e1d5b to your computer and use it in GitHub Desktop.
Post Meta
<?php
add_post_meta( get_the_ID(), 'checked_by_ceo', true, true );
?>
<?php
$ingredients = get_post_meta( get_the_ID(), "ingredients", false );
if( !empty( $ingredients ) ) {
echo "<h3>Ingredients:</h3>";
echo "<ul>";
foreach( $ingredients as $ingredient ) {
echo "<li>" . $ingredient . "</li>";
}
echo "</ul>";
}
?>
<?php
update_post_meta( get_the_ID(), 'ingredients', 'salmon', 'fish' );
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment