Sidenotes Wordpress
Sidenotes Wordpress
Out of context: Reply #2
- Started
- Last post
- 5 Responses
- acescence0
add a custom field to your post (custom fields is a dropdown when you are creating a post).
insert a template tag in single.php to fetch the meta data (where custom fields are stored) and print it on your page.
<?php the_meta(); ?>
- will print all meta data in ul with each field being an lior
get_post_meta($post_id, $key, $single);
- gives access to fields individually
- $post_id is the ID of the post you want the meta values for. Use $post->ID to get a post's ID.
- $key is a string containing the name of the meta value you want.
- $single can either be true or false. If set to true then the function will return a single result, as a string. If false, or not set, then the function returns an array of the custom fields.