Created
October 5, 2018 18:21
-
-
Save tessak22/4d0480883e639bed703526dff7c46045 to your computer and use it in GitHub Desktop.
Page template to display my Dogs Custom Post Type
This file contains 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
<?php | |
/** | |
* Template Name: Dogs | |
* | |
* @link https://codex.wordpress.org/Template_Hierarchy | |
* | |
* @package WordPress | |
* @subpackage Twenty_Seventeen | |
* @since 1.0 | |
* @version 1.0 | |
*/ | |
$args = array ( | |
'post_type' => 'dogs', | |
); | |
$children = new WP_Query($args); | |
get_header(); ?> | |
<div class="wrap"> | |
<div id="primary" class="content-area"> | |
<main id="main" class="site-main" role="main"> | |
<?php if ($children->have_posts()) : ?> | |
<?php while ($children->have_posts()) : $children->the_post(); $fields = (object) get_fields(); ?> | |
<div> | |
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> | |
<?php the_excerpt(); ?> | |
<?php if(get_field('FIELD_NAME')): ?> | |
<p><?php the_field('FIELD_NAME'); ?></p> | |
<?php endif; ?> | |
</div> | |
<?php endwhile; wp_reset_postdata(); ?> | |
<?php endif; ?> | |
</main><!-- #main --> | |
</div><!-- #primary --> | |
</div><!-- .wrap --> | |
<?php get_footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment