Created
September 8, 2016 14:47
-
-
Save purethemes/42906a22ef4be8787182a4200a8cc9f4 to your computer and use it in GitHub Desktop.
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 | |
$layout = get_option( 'pp_blog_layout', 'right-sidebar' ); | |
$class = ($layout=='full-width') ? 'eight' : 'half-eleven' ; | |
$container_class = ($layout=='full-width') ? 'sixteen' : 'eleven' ; | |
$magazine_content = get_option('pp_magazine_categories'); | |
foreach ($magazine_content as $content) { ?> | |
<div class="<?php echo esc_attr($container_class ); ?> columns alpha omega"> | |
<div class="headline alt"> | |
<h3><a href="<?php echo esc_url(get_category_link($content['section_category'])); ?>"><?php echo esc_html($content['section_header']); ?></a></h3><span class="line"></span> | |
</div> | |
</div> | |
<?php | |
$args = array( | |
'post_type' => 'post', | |
'posts_per_page' => $content['section_posts'], | |
'category__in' => $content['section_category'] | |
); | |
// the query | |
$query = new WP_Query( $args ); | |
$i=1; | |
if ( $query->have_posts() ) { | |
$closed = false; | |
while ( $query->have_posts() ) : $query->the_post() ; | |
$id = $query->post->ID; | |
$format = get_post_format($id); if( false === $format ) $format = 'standard';$i++; | |
if($i==1) { | |
get_template_part( 'post-formats/default', $format ); | |
} else { | |
if ($i % 2 == 0) { | |
echo '<div class="eleven columns alpha omega"> | |
<div class="half-eleven columns alpha">'; | |
get_template_part( 'post-formats/column', $format ); | |
echo '</div>'; | |
$closed = false; | |
} else { | |
echo '<div class="half-eleven columns omega">'; | |
get_template_part( 'post-formats/column', $format ); | |
echo '</div> | |
</div>'; | |
$closed = true; | |
} | |
} | |
endwhile; | |
if($closed==false){ | |
echo "</div>"; | |
} | |
} | |
?> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment