Title: active page problem
Last modified: August 19, 2016

---

# active page problem

 *  [Apoellin](https://wordpress.org/support/users/panism/)
 * (@panism)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/active-page-problem/)
 * Hi.
 * I have a problem on my home page. I use pictures display in home page from a 
   category name”new works”. But the active link is on the category name not the
   home page. Look here: [http://www.kikoslanitis.com/](http://www.kikoslanitis.com/)
 * The code in index file is like this:
 *     ```
       <div class="news">
   
                       <?php query_posts('showposts=7&category_name=new works');
       				  	if (have_posts()) : ?><?php while (have_posts()) : the_post();
       					$image = "";
       					$first_image = $wpdb->get_results(
   
       					"SELECT guid FROM $wpdb->posts WHERE post_parent = '$post->ID' "
       					."AND post_type = 'attachment' ORDER BY <code>post_date</code> ASC LIMIT 0,1"
   
       					);
   
       					if ($first_image) {
       						$image = $first_image[0]->guid;
       					}
                       ?>
                       	<div class="pic">
                   			<a href="<?php the_permalink() ?>" rel="<? bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $image; ?>">
       						<img src="<? bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $image; ?>&w=50&h=50&zc=1&q=100" /></a>
                   	</div> <!-- .pic -->
       				<?php endwhile; ?><?php endif; ?>
   
                   </div>
       ```
   
 * If i remove the “&category_name=new works” is working fine but i want display
   images from that category only. The active class is working fine in the other
   pages. Also my nav bar is on the footer. Here is the code:
 *     ```
       <ul class="page">
                   	<li><a href="<?php echo get_option('home'); ?>" accesskey="1" <?php if( is_home()) : ?> class="active" <?php endif; ?> title="Back to Frontpage">Home</a></li>
       			<?php
       			if( is_page() ) $curpage = $post->ID;
       			$pages = get_pages('sort_column=menu_order');
       			foreach( $pages as $page ) {
       				$this_css = '';
       				$this_link = get_page_link($page->ID);
       				if( $curpage == $page->ID ) $this_css = ' class="active"';
       				echo "<li><a $this_css href=\"$this_link\">" . $page->post_title . "</a></li>\n\t\t";
       			} ?>
                   </ul>
                   <div class="ffix"></div>
               </div>
               <div class="category">
               	<h2>Portfolio</h2>
                   <ul class="cats">
                   	<?php wp_list_categories('title_li=&orderby=ID'); ?>
                   </ul>
               </div>
       ```
   
 * Anyone can help?
    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/active-page-problem/#post-1955240)
 * try to add `wp_reset_query();` here after the `endif;` :
 * `<?php endwhile; ?><?php endif; ?>`
 * [http://codex.wordpress.org/Function_Reference/wp_reset_query](http://codex.wordpress.org/Function_Reference/wp_reset_query)
 *  Thread Starter [Apoellin](https://wordpress.org/support/users/panism/)
 * (@panism)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/active-page-problem/#post-1955253)
 * Thanks man. I ve already try that. Not working
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/active-page-problem/#post-1955256)
 * > Thanks man. I ve already try that.
 * did the ‘active’ on the category link dissappear when you tried that?
 * you could also try:
 * `<?php if( is_home() || is_front_page() ) : ?> class="active" <?php endif; ?>`
 *  Thread Starter [Apoellin](https://wordpress.org/support/users/panism/)
 * (@panism)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/active-page-problem/#post-1955266)
 * Yes my friend the active on the category dissapeared when i tried your first 
   solution. Nothing was showing as active. I ve tried the second solution you gave
   me but it remains active the category again… I dont know if it has something 
   to do with the archive.php or functions.php. But when i remove the “&category_name
   =new works” everything working fine
    Thanks again for your reply…

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘active page problem’ is closed to new replies.

## Tags

 * [active page](https://wordpress.org/support/topic-tag/active-page/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [Apoellin](https://wordpress.org/support/users/panism/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/active-page-problem/#post-1955266)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
