Hi there im using the grid as a template, i have added a new “_index.php” in x-child global.
2 problems:
1- sometimes drafts show up in the grid
2- certain posts get duplicated
my code:
<?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 ) { 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
if (have_posts()) {
$index_grid = get_page_by_title(html_entity_decode('Index Grid'), 'OBJECT', 'the_grid');
$archive_grid = get_page_by_title(html_entity_decode('Archive Grid'), 'OBJECT', 'the_grid');
$search_grid = get_page_by_title(html_entity_decode('Search Grid'), 'OBJECT', 'the_grid');
if ($index_grid && (is_home() || is_front_page())) {
The_Grid('Index Grid', true);
} else if ($archive_grid && is_archive()) {
The_Grid('Archive Grid', true);
} else if ($search_grid && is_search()) {
The_Grid('Search Grid', true);
} else {
while (have_posts()) {
the_post();
if ( $stack != 'ethos' ) {
x_get_view( $stack, 'content', get_post_format() );
} else {
x_ethos_entry_cover( 'main-content' );
}
}
}
} else {
x_get_view( 'global', '_content-none' );
}
?>
</div>
<?php
} else {
if ( have_posts() ) {
$index_grid = get_page_by_title(html_entity_decode('Index Grid'), 'OBJECT', 'the_grid');
$archive_grid = get_page_by_title(html_entity_decode('Archive Grid'), 'OBJECT', 'the_grid');
$search_grid = get_page_by_title(html_entity_decode('Search Grid'), 'OBJECT', 'the_grid');
if ($index_grid && (is_home() || is_front_page())) {
The_Grid('Index Grid', true);
} else if ($archive_grid && is_archive()) {
The_Grid('Archive Grid', true);
} else if ($search_grid && is_search()) {
The_Grid('Search Grid', true);
} else {
while (have_posts()) {
the_post();
x_get_view( $stack, 'content', get_post_format() );
}
}
} else {
x_get_view( 'global', '_content-none' );
}
}
if (!is_home() && !is_front_page() && !is_archive()) {
pagenavi();
}
?>