Skip to content

Instantly share code, notes, and snippets.

@romuloctba
Last active August 29, 2015 14:16
Show Gist options
  • Save romuloctba/a4795daf301ce5b96284 to your computer and use it in GitHub Desktop.
Save romuloctba/a4795daf301ce5b96284 to your computer and use it in GitHub Desktop.
Custom Wordpress Loop with custom fields from types plugin
<?php
$args = array(
'post_type' => 'post-slug',
'posts_per_page' => 6
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
//customfields
$cfname = get_post_meta( $post->ID, 'wpcf-CFSLUGHERE', true);
?>
<!-- begin content here -->
<h1>
<?php the_title(); ?>
</h1>
<span class="customfield">
<?php echo $cfname; ?>
</span>
<!-- end content here -->
<?php
endwhile;
wp_reset_query();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment