[wp-testers] Can't use $wp_query the same way anymore

Doug Stewart zamoose at gmail.com
Sat Dec 24 16:33:40 GMT 2005


Excellent.  Glad I could be of help.  *grin*

-Doug

On 12/24/05, Karl Wångstedt <wordpress at wangstedt.net> wrote:
> 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.
>
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>


More information about the wp-testers mailing list