[wp-testers] is_post_type not working correctly

hedwig at senzafineonline.net hedwig at senzafineonline.net
Fri Jun 4 16:49:19 UTC 2010


I tried with is_singular() but it didn't work.

This is the code I used and worked before RC1 and RC2

	$movie_pages = query_posts(array(
		'orderby' => 'title',
		'posts_per_page' => -1,
		'post_status' => 'publish',
		'movie' => $movie_title
	));

	if ( have_posts() ) : while ( have_posts() ) : the_post();

		if ( is_singular('video') )
			$videos .= '
				<li><a href="'. get_permalink() .'" title="'. get_the_title 
() .'">'. remove_movie_title( get_the_title() ) .'</a></li>';

		if ( is_singular('gallery') )
			$gallery .= '
				<li><a href="'. get_permalink() .'" title="'. get_the_title 
() .'">'. remove_movie_title( get_the_title() ) .'</a></li>';

	endwhile; endif;

What the code did was query all the post related to the current film,  
and group them by post type to use in the sidebar menu. With the RC  
versions now it doesn't distinguish between post types and each  
section show ALL posts rather than just the matching post types (i.e.  
video or gallery)

Using is_singular() doesn't display anything at all.

You can see my sidebar menu functionality here: http:// 
moviefy.senzafineonline.net/movies/prince-of-persia-the-sands-of-time


More information about the wp-testers mailing list