Hi!
I’ve got a custom post type set up on my site, and I’m trying to keep the blog posts and custom posts (“entries”) separate on the Tag archive pages. I’ve managed to get it all working, except that the blog posts, which are shown second, are showing in one vertical column with 50% width instead of a 2-column masonry layout. I’m sure it’s because of having two x-iso-container in the same page, but I can’t figure out how to fix it. Can you please help? The code is as below:
<?php
// =============================================================================
// VIEWS/GLOBAL/_INDEX.PHP
// -----------------------------------------------------------------------------
// Includes the index output.
// =============================================================================
$stack = x_get_stack();
if ( is_home() ) :
$style = x_get_option( 'x_blog_style' );
$cols = x_get_option( 'x_blog_masonry_columns' );
$condition = is_home() && $style == 'masonry';
elseif ( is_archive() ) :
$style = x_get_option( 'x_archive_style' );
$cols = x_get_option( 'x_archive_masonry_columns' );
$condition = is_archive() && $style == 'masonry';
elseif ( is_search() ) :
$condition = false;
endif;
?>
<?php if ( $condition ) : ?>
<center><?php echo "<h2>Literary Destinations</h2>" ; ?></center>
<?php x_get_view( 'global', '_script', 'isotope-index' ); ?>
<div id="x-iso-container" class="x-iso-container x-iso-container-posts cols-<?php echo $cols; ?>">
<?php $args = array(
'post_type' => 'entries',
'tag' => $tag
);
$query = new WP_Query( $args ); ?>
<?php if ( $query->have_posts() ):
while ( $query->have_posts() ) : $query->the_post();
x_get_view( $stack, 'content', get_post_format() );
endwhile;
else : x_get_view( 'global', '_content-none' ) ;
endif; ?>
</div>
<center><?php echo "<h2>Blog Posts</h2>" ; ?></center>
<div id="x-iso-container" class="x-iso-container x-iso-container-posts cols-<?php echo $cols; ?>">
<?php if ( have_posts() ):
while ( have_posts() ) : the_post();
x_get_view( $stack, 'content', get_post_format() );
endwhile;
else : x_get_view( 'global', '_content-none' ) ;
endif; ?>
</div>
<?php else : ?>
<?php x_get_view( 'global', '_content-none' ); ?>
<?php endif; ?>
<?php pagenavi(); ?>