Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Add class to current link


I have this code below and I would like to add "active" or some different class name to a tag that is containing current page link, if you understand me...

I know that there is function that would do that to menu items but since this is not menu item I'm not sure how to do it?

'''PHP <?php $new_loop = new WP_Query( array( 'post_type' => 'case-studies' ) ); ?> <?php if ( $new_loop->have_posts() ) : $i=0; ?> <?php while ( $new_loop->have_posts() ) : $new_loop->the_post(); $i++; ?>

                                            <a href="<?php the_permalink(); ?>">
                                                <?php $image = get_field('logo'); if( !empty($image) ): ?>
                                                <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" class="logo"/>
                                                <?php endif; ?>

                                <?php endwhile;?>
                            <?php endif; ?>
                        <?php wp_reset_query(); ?>