Skip to content

Instantly share code, notes, and snippets.

@davereese
davereese / theQuery.php
Created March 12, 2015 20:26
Custom Post Types with ACF
<?php
$args = array(
'post_type' => 'products',
'post_status' => 'publish',
'posts_per_page' => '10'
);
$products_loop = new WP_Query( $args );
if ( $products_loop->have_posts() ) :
while ( $products_loop->have_posts() ) : $products_loop->the_post();
// Set variables
@davereese
davereese / RegisterCPT.php
Created March 12, 2015 20:25
Custom Post Type and ACF Example
<?php
// Register Custom Post Types
add_action('init', 'register_custom_posts_init');
function register_custom_posts_init() {
// Register Products
$products_labels = array(
'name' => 'Products',
'singular_name' => 'Product',
'menu_name' => 'Products'