Skip to content

Instantly share code, notes, and snippets.

@DmitriyRF
Created July 21, 2018 20:43
Show Gist options
  • Save DmitriyRF/2fecf5727f61529934369e0406cbb497 to your computer and use it in GitHub Desktop.
Save DmitriyRF/2fecf5727f61529934369e0406cbb497 to your computer and use it in GitHub Desktop.
Query for custom post type, wordpress, Query,
<?php
get_header();
$the_query = new WP_Query( array( 'post_type' => 'posttype' ) );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
the_title();
// the_post_thumbnail();
the_post_thumbnail_url();
$mg_data = get_post_meta( $post->ID, 'posttype_meta_keys', true );
print_r($mg_data);
}
wp_reset_query();
} else {
echo 'No managers';
}
get_footer();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment