How can you add content to post/page using custom fields?
Detailed Explanation
Steps to add custom fields to post/page:
1.Go to screen option of a post/page and select custom field.
2.And scroll down to post editor ,click to add new custom field.
3.Add information to value field and save this information.
4.Now call custom field using the following function with the custom field name.
Syntax:
<?php if ( get_post_meta($post->ID, 'wpfp_favorites', true) ) : ?>
<?php echo get_post_meta($post->ID, 'wpfp_favorites', true); ?>
<?php endif; ?>
Example: Adding adress to post/page:
<?php if ( get_post_meta($post->ID, 'address', true) ) : ?>
<?php echo get_post_meta($post->ID, 'adress', true); ?>
<?php endif; ?>
Custom field name: address
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts