Created
August 16, 2016 12:17
-
-
Save BenBroide/dbc03673218bf91e674c96b3190cde8d to your computer and use it in GitHub Desktop.
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
| function get_post_metas( $post_id , $fields_array , $single ){ | |
| $fields_array_data = array(); | |
| if( is_array( $fields_array )){ | |
| foreach( $fields_array as $key => $value){ | |
| $fields_array_data[] = get_post_meta( $post_id, $value , $single ); | |
| } | |
| } | |
| if( !is_array( $fields_array )){ | |
| $fields_array_data[] = get_post_meta( $post_id, $fields_array , $single ); | |
| } | |
| return $fields_array_data; | |
| } | |
| // Use | |
| get_post_metas( $post_id , array ( ‘date’, , 'location' ) , TRUE ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment