Skip to content

Instantly share code, notes, and snippets.

@taniarascia
Created August 26, 2015 20:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taniarascia/46206dc09f47146771e2 to your computer and use it in GitHub Desktop.
Save taniarascia/46206dc09f47146771e2 to your computer and use it in GitHub Desktop.
Pull without query_posts
$args = array(
'post_type' => 'post-custom',
'order' => 'ASC',
'posts_per_page' => -1,
'fields' => 'ids'
);
$post_ids = get_posts( $args );
foreach ( $post_ids as $id ) {
$meta = get_post_meta( $id, '_my_meta', true );
echo '<img src="' . $meta['img'] . '">';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment