[wp-testers] Can't use $wp_query the same way anymore
Karl Wångstedt
wordpress at wangstedt.net
Sat Dec 24 15:19:33 GMT 2005
I'll answer myself on this one. After some testing I figured it out.
Seems like the variables inside a WP_Query() are treated the same way
as in the Loop now-days. Witch means that I have to extract the
content of $id before the WP_Query() to use in the if argument. The
code now looks like this:
<ul>
<?php $my_id = $post->ID; ?>
<?php $my_query = new WP_Query('cat=1');
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li class="page_item<?php if (is_single()) {
if ($post->ID == $my_id)
{
echo (' current_page_item');
}
}
?>"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; ?>
</ul>
---------------------------------
W W W . W A N G S T E D T . N E T
Karl Wångstedt 0278-61 12 33
Stenhuggarvägen 3g 070-578 13 04
821 41 BOLLNÄS
---------------------------------
Det här brevet skickades med en Macintosh från Apple.
Garanterat virusfri med Mac OS X.
More information about the wp-testers
mailing list