Skip to content

Instantly share code, notes, and snippets.

@celticwebdesign
Last active April 18, 2016 21:03
Show Gist options
  • Save celticwebdesign/12ec494e767241cb913c to your computer and use it in GitHub Desktop.
Save celticwebdesign/12ec494e767241cb913c to your computer and use it in GitHub Desktop.
<?php
// If needed to get a specific category
// echo "<pre>";
// var_dump($wp_query->query_vars);
// echo "</pre>";
// echo $wp_query->query_vars['gallery-category'];
$args = array(
'post_type' => 'document',
'post_status' => 'publish',
'posts_per_page' => 3,
'tax_query' => array(
array(
'taxonomy' => 'doc-category',
'field' => 'slug',
'terms' => 'notices-to-mariners'
)
)
);
// The query
$child_query = new WP_Query($args);
// The loop
if( $child_query->have_posts() ) : while ( $child_query->have_posts() ) : $child_query->the_post(); ?>
<!-- article -->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="row">
<div class="col-md-9">
<div class="date"><?php echo get_field('mariners_date_selected'); ?></div>
<div class="notice"><?php echo get_the_title(); ?></div>
<?php
$rows = get_field('mariners_list_repeater', get_the_ID());
if($rows) {
echo "<!-- mariners_list_repeater -->";
echo "<ul class='mariners_list'>";
foreach($rows as $row) {
echo "<li class='item'>";
echo $row['mariners_list_item'];
echo "</li>";
}
echo "</ul>";
echo "<!-- /mariners_list_repeater -->";
}
if( get_field('mariners_notice_pdf', get_the_ID()) ) {
echo '<a href="'.get_field("mariners_notice_pdf", get_the_ID()).'" title="'.get_the_title().'" class="view-notice" target="_blank">View Notice</a>';
}
?>
</div>
</div>
</article>
<!-- /article -->
<?php endwhile; endif;
wp_reset_postdata();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment