Skip to content

Instantly share code, notes, and snippets.

@netconstructor
Last active August 29, 2015 14:21
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 netconstructor/e413bcc4436dfb839299 to your computer and use it in GitHub Desktop.
Save netconstructor/e413bcc4436dfb839299 to your computer and use it in GitHub Desktop.
<?php /* Template Name: Projects */ ?>
<?php get_header(); ?>
<main id="primary" class="content-area">
<div class="jumbotron">
<div class="row">
<div class="intro"><?php the_field('projects_heading') ?></div>
</div>
</div>
<div class="projects body-content">
<div class="row project-list">
<div class="column-wrapper">
<?php
$args = array (
'post_type' => 'project', // target the post-type for projects
'post_per_page' => '20', // display (at max) (x) at once
'nopaging' => true, // disable automatic pagination
'order' => 'ASC', // display order = ascending
'orderby' => 'title' // organized based on the the_title() of the post
);
$projects = new WP_Query( $args );
if ( $projects->have_posts() ) {
?>
<div class="project-listing">
<?php while ( $projects->have_posts() ) {
$projects->the_post();
?>
<div class="columns ui-listing-block">
<hr/>
<h2><?php the_field('project_title') ?></h2>
<?php if( have_rows('project_date_range') ): ?>
<span>
<?php while( have_rows('project_date_range') ): the_row(); ?>
<?php the_sub_field('project_year_start'); ?>-<?php the_sub_field('project_year_end'); ?>
<?php endwhile; ?>
</span>
<?php endif; ?>
<?php echo project_excerpt(); ?>
<a href="<?php the_permalink(); ?>" title="Learn more about the project: <?php the_field('project_title') ?>" class="button postfix">Learn More</a>
</div>
<?php } ?>
</div>
<?php } else { ?>
<p>No Projects Available.</p>
<?php } wp_reset_postdata(); ?>
</div>
</div>
</div>
</main>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment