Hi I've been googling for a while and I can't find help for this. I've got a page template that is listing a bunch of custom posts...I'm using this code before the loop to display my custom posts:
<?php query_posts( array( 'post_status' => 'publish' , 'post_type' => array( 'ncp_news' ) ) ); ?>
When I remove this to make it a normal page I can display my custom sidebar fine so I know it's got to do with the blog (custom) posts...
Here's the full code:
<div class="posts_wrapperk">
<?php query_posts( array( 'post_status' => 'publish' , 'post_type' => array( 'nyacp_news' ) ) ); ?>
<?php if (have_posts()) : while(have_posts()) : the_post(); ?>
<?php
$sidebar_position = vp_metabox('_page_sidebar.sidebar_position');
$main_classes = 'main';
$aside_classes = 'aside';
if (!empty($sidebar_position)) {
$opp = (($sidebar_position == 'left') ? 'right' : 'left');
$main_classes .= " grid-9 $opp";
$aside_classes .= " grid-3 $sidebar_position";
}
?>
<section id="content"<?php echo qualia_build_class(array("content", "section", "color- palette-1", "separator-{$qualia_content_separator}")); ?>>
<div class="section-inner">
<div class="wrapper">
<div<?php echo (!empty($sidebar_position)) ? ' class="grids"' : ''; ?>>
<div class="<?php echo $main_classes; ?>">
<article id="page-<?php the_ID(); ?>" <?php post_class('original-content'); ?>>
<h1 class="nyacp-subheader"><?php echo get_the_title($ID); ?></h1>
<?php the_content(); ?>
</article>
</div>
</div>
</div>
<?php //echo qualia_spacer(array('size' => $qualia_content_bottom_spacing)); ?>
</section>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
</div><!--.posts_wrapperk-->
<?php if (!empty($sidebar_position)) : ?>
<div class="<?php echo $aside_classes; ?> inner_sidebar">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('innerpage-sidebar') ) : endif; ?>
</div>
<?php endif; ?>
<?php get_footer(); ?>
How do I make my sidebar appear while displaying custom posts?
query_posts
. The correct way to construct a custom query is usingWP_Query