Created
February 14, 2018 17:26
-
-
Save nixonmedia/aa1a6554b1eedfce2f73b8dc0dc9ec51 to your computer and use it in GitHub Desktop.
This file contains hidden or 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: Taking Action */ | |
get_header(); | |
global $post; | |
$postID = $post->ID; | |
global $postID; | |
?> | |
<div class="wrap container"> | |
<div class="content-area row" > | |
<div class="col-md-8" id="content"> | |
<?php get_template_part('template-parts/navigation/navigation','breadcrumbs'); ?> | |
<h1><?php the_title(); ?> </h1> | |
<?php | |
include(locate_template('/template-parts/page/content-flexible.php')); | |
?> | |
<?php | |
$args = array ( | |
'post_type' => 'ta_item', | |
'posts_per_page'=>4 | |
); | |
$query_pr = new WP_Query( $args ); | |
?> | |
<h1><?php single_term_title(); ?></h1> | |
<?php echo get_post_field('post_content', 3444);?> | |
<?php if ( $query_pr->have_posts() ) : | |
$count = 0; | |
while ( $query_pr->have_posts()) : $query_pr->the_post(); | |
global $post; | |
if ($count%3 == 1 || $count == 0) : ?> | |
<div class="row"> | |
<?php endif; ?> | |
<div class="col-<?php | |
if ($count == 0) : | |
echo 'md-12'; | |
else : | |
echo 'sm-4'; | |
endif; ?>"> | |
<div class="article article-<?php | |
if ($count == 0) : | |
echo 'primary mb-4 clearfix'; | |
else : | |
echo 'secondary'; | |
endif; ?>"> | |
<a href="<?php the_permalink(); ?>"> | |
<?php if ($count == 0) :?> | |
<div class="date"><?php echo get_the_date(); ?></div> | |
<h4 class="pb-2"><?php the_title(); ?></h4> | |
<?php endif; ?> | |
<?php | |
if ($count == 0) : | |
$img = ''; | |
$img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'landing-intro-image' ); | |
$img = $img[0]; | |
echo '<img class="float-left" src="'.$img.'">'; | |
else : | |
$img = ''; | |
$img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'ta-sm' ); | |
$img = $img[0]; | |
echo '<img class="float-left" src="'.$img.'">'; | |
endif; | |
?> | |
<?php if ($count != 0) :?> | |
<h4><?php the_title(); ?></h4> | |
<div class="date"><?php echo get_the_date(); ?></div> | |
<?php endif;?> | |
</a> | |
<?php | |
$author = get_field('author_text'); | |
if (!empty($author)) : ?> | |
<p class="credit">Written by <?php echo $author; ?></p> | |
<?php endif; | |
if (has_excerpt( $post->ID )) : ?> | |
<p><?php the_excerpt(); ?></p> | |
<?php endif; ?> | |
</div> | |
</div> | |
<?php if ($count%3 == 0) : ?> | |
</div> | |
<?php endif; | |
$count++; | |
endwhile; | |
if ($count%3 != 1) : ?> | |
</div> | |
<?php endif; ?> | |
<?php endif; ?> | |
<div class="more"> | |
<a class="btn blue mb-5" href="/taking-action-archive"><i class="fa fa-list-ul"></i> View Press Archive</a> | |
</div> | |
</section> | |
</div><!--/#content--> | |
<div class="col-xs-12 col-md-4 sidebar d-flex align-items-stretch"> | |
<div class="contents"> | |
<?php get_sidebar('ta'); ?> | |
<?php | |
wp_reset_query(); | |
?> | |
<strong>Taking Action Topics</strong> | |
<?php | |
$args = array ( | |
'taxonomy' => 'ta_topic', //empty string(''), false, 0 don't work, and return empty array | |
'orderby' => 'name', | |
'order' => 'ASC', | |
'hide_empty' => true, //can be 1, '1' too | |
); | |
$terms = get_terms($args); | |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ | |
echo '<ul class="taking-action-topics">'; | |
foreach ( $terms as $term ) { | |
echo '<li><a href="/taking-action/topic/'.$term->slug.'">' . $term->name . '</a></li>'; | |
} | |
echo '</ul>'; | |
} | |
?> | |
</div><!--/.contents--> | |
</div> | |
</div><!-- #primary --> | |
</div><!-- .wrap --> | |
<?php get_footer();?> | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment