I have trouble with active class in home page
-
Hi all
I have a problem with active class in my home page.In my home page i display pictures from a category called “new works”.
But instead to be “Home” as active page, is the category “New works”.
All the other pages are working just fine…Here is the code in the index.php file:
`<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 BYpost_date
ASC LIMIT 0,1″);
if ($first_image) {
$image = $first_image[0]->guid;
}
?>
<div class=”pic”>
” 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″ />
</div> <!– .pic –>
<?php endwhile; ?><?php endif; ?></div>
If i remove the “&category_name=new works” is working fine but i want to display the images only from that category…
My navication bar is in the footer. Here is the code:
<ul class=”page”>
- ” accesskey=”1″ <?php if( is_home()) : ?> class=”active” <?php endif; ?> title=”Back to Frontpage”>Home
- ” . $page->post_title . “
<?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 “\n\t\t”;
} ?><div class=”ffix”></div>
</div>
<div class=”category”>
<h2>Portfolio</h2>
<ul class=”cats”>
<?php wp_list_categories(‘title_li=&orderby=ID’); ?></div>
Can somebody help me please?
Thanks in advance[ duplicate: https://www.ads-software.com/support/topic/active-page-problem?replies=1 ; closed ]
- The topic ‘I have trouble with active class in home page’ is closed to new replies.