I'm trying to minimize my code and have put together this little snippet, it doesn't seem to work howeve开发者_运维问答r. What am I missing?
query_posts( 'year=2011' );
if ( have_posts() );
while ( have_posts() );
echo 'test';
endwhile;
wp_reset_query();
endif;
I think that your problem is the question mark at the end of the if and at the end of while. IMy opinion is that you need a colon ":"
query_posts( 'year=2011' );
if(have_posts()):
while(have_posts()):
echo 'test';
endwhile;
wp_reset_query();
endif;
精彩评论