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: https://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)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘active page problem’ is closed to new replies.