Forums

Custom Post Type's and conditional tags in Widget Logic (1 post)

  1. mattywebb
    Member
    Posted 8 months ago #

    Hi there,

    Im setting up a site, i have a standard blog on the front page - and i have used the "widget logic" plug in to define what sidebar modules I want on the front page, and which ones should be on the rest.

    It was all working fine... Ive now used the "Custom Post Type Manger" to create a custom post type. Im using a custom wp_query to call posts from this post type...

    However - for reasons i can't explain - the sidebar seams to forget that i have told it to only display specific things on this page - and just defaults to what is shown on the front page...

    Im banging my head against the wall - if anyone can help it would be very much appreciated...

    Here is my page displaying custom post types...
    http://203.123.59.75/~ninaleve/about/film/

    The sidebar should be displaying the same stuff as this page (it was before i inserted the custom loop)
    http://203.123.59.75/~ninaleve/about/

    Here is the code i have used in the template with the custom query..

    <?php
    /*
    Template Name: Film Template
    */
    ?>
    <?php get_header(); ?>
    
    <h1>Film</h1>
    
    <section id="main-content">	
    
    	<?php global $wp_query;
    
    	$wp_query = new WP_Query("post_type=film&post_status=publish");
    	while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    	<article <?php post_class() ?> id="post-<?php the_ID(); ?>">
    
    	<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    
    	<?php the_content(); ?>
    
    	</article>
    	<?php endwhile; ?>
    
    	<?php wp_reset_query(); ?>
    
    </section>	
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

Reply

You must log in to post.

About this Topic