Adding a .current class to a query_posts array
-
<?php query_posts(array('post_parent' => 6, 'post_type' => 'page')); while (have_posts()) { the_post(); $current_id = $post->ID; ?> <li <?php $class = ($current_id == $post->ID) ? ' class="current_page' : '';?>> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('align=left'); ?> <span class="products_title"><?php the_title(); ?></span> <span class="products_arrow">></span></a> </li> <?php } ?>
This is what I currently have. and clearly something is wrong with it. I want to add class .current_page to the current page. Is this possible, am I just missing something dumb?
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Adding a .current class to a query_posts array’ is closed to new replies.