Last active
August 27, 2015 15:41
-
-
Save wisecrab/aa715c148af3c640bab0 to your computer and use it in GitHub Desktop.
Easy to use functions for getting access to custom meta data for posts and custom posts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /***************************************************** | |
| *** Get all taxonomy terms for a post *** | |
| *****************************************************/ | |
| get_the_term_list( $post->ID, 'taxonomy_name' ); //Returns links | |
| get_the_term_list( $post->ID, 'taxonomy_name', '', ', ', '' ); //Returns links separated by commas | |
| strip_tags(get_the_term_list( $post->ID, 'taxonomy_name' )); //Returns text | |
| /***************************************************** | |
| *** Get custom fields for a post *** | |
| *****************************************************/ | |
| //Get custom fields from a post | |
| get_post_meta( $post->ID, 'custom_field', true); //true returns string, false returns array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment