October 30, 201015 yr Hey Guys, The problem can be seen on any of the category archive pages. See here: http://alihitch.com/.../all-tutorials/ For some reason, even though the page is showing the 'all tutorials' category link, it is also displaying a link to the 'other' category. This is the same for all categories. Archive file code can be seen below. Anybody have any idea why this is happening? **NOTE: I had originally put the 'other' and 'html/css tutorials' category as children categories of 'all tutorials'. They are not children categories any more. Perhaps that is a cause? <?php get_header(); ?> <div class="b-wrap"> <section class="a-wrap"> <?php the_post(); ?> <?php if ( is_day() ) : ?> <div class="a-year"> <h2 class="page-title"><?php printf(get_the_time(get_option('date_format')) ) ?></h2> </div><!-- .a-year --> <?php elseif ( is_month() ) : ?> <div class="a-year"> <h2 class="page-title"><?php printf(get_the_time('F Y') ) ?></h2> </div><!-- .a-year --> <?php elseif ( is_year() ) : ?> <div class="a-year"> <h2><?php printf(get_the_time('Y')) ?></h2> </div><!-- a-year --> <div class="clear"></div> <?php elseif ( is_category() ) : ?> <div class="a-year"> <h2><?php printf(the_category()) ?></h2> </div><!-- a-year --> <?php elseif ( isset($_GET['paged']) && !empty($_GET['paged']) ) : ?> <h1 class="page-title"><?php _e( 'Blog Archives', 'your-theme' ) ?></h1> <?php endif; ?> <?php rewind_posts(); ?> <?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?> <div id="nav-above" class="navigation"> <div class="nav-previous"> <?php next_posts_link(__( '<span class="meta-nav">«</span> Older posts', 'your-theme' )) ?> </div><!-- .nav-previous --> <div class="nav-next"> <?php previous_posts_link(__( 'Newer posts <span class="meta-nav">»</span>', 'your-theme' )) ?> </div><!-- .nav-next --> </div><!-- #nav-above .navigation --> <?php } ?> <?php while ( have_posts() ) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <div class="line"></div> <h2 class="search <?php the_ID(); ?>"><a class="search-a no-border" href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2> <time class="search-date"> <div class="left-date"> <div class="search-day d-<?php the_time('d') ?>"><?php the_time('d') ?></div> <div class="search-month m-<?php the_time('m') ?>"><?php the_time('M') ?></div> </div> <div class="search-year y-<?php the_time('Y') ?>"><?php the_time('Y') ?></div> </time><!-- .search-date --> <?php include (TEMPLATEPATH . '/inc/meta-search.php' ); ?> <div class="clear"></div> <div class="entry"> <?php the_excerpt(); ?> </div><!-- .entry --> </div> <?php endwhile; ?> <?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?> <div id="nav-below" class="navigation"> <div class="nav-previous"> <?php next_posts_link(__( '<span class="meta-nav">«</span> Older posts', 'your-theme' )) ?> </div> <div class="nav-next"> <?php previous_posts_link(__( 'Newer posts <span class="meta-nav">»</span>', 'your-theme' )) ?> </div> </div><!-- #nav-below --> <?php } ?> </section><!-- .a-wrap --> <?php include ('asider-r.php'); ?> <div class="clear"></div> </div><!-- .b-wrap --> <?php get_footer(); ?> Thanks, Ali
November 4, 201015 yr well if I am correct u mean the find by category part on sidebar , which is on asider-r.php we dont see it here , and if u are using wp_list_category for that , then simply exclude other from it , see here http://codex.wordpress.org/Function_Reference/wp_list_categories .or remove the other category if u dont need it , or set it's parent to no , so it wont show as a child of all tutorial category.
November 4, 201015 yr Author Hey JPR-UK, The problem is with the Archive page, not the aside-r.php i'm pretty sure. The title has changed yet again ... The last post had 2 categories: photography and photoshop tutorials which child categories of All Tutorials. It seems that the title of http://alihitch.com/.../all-tutorials/ is always the child categories of the latest post, when in this instance, it should be the parent category (all-tutorials) as this is the category being shown, not the children. The code for this particular section is now: <div class="a-year"> <h2> <?php foreach((get_the_category()) as $category) { $postcat= $category->cat_ID; $catname =$category->cat_name; echo $catname; } ?> </h2> </div><!-- a-year --> Pretty confusing I know. Hopefully somebody can figure this one out!
November 4, 201015 yr Author Just had a brainwave. Fix was simple really, although it's probably more of a hack than proper fix. For all of the child categories as well as the parent, I simply added the the PHP code as follows: <?php elseif ( is_category('3') ) : ?> <div class="a-year"> <h2>All Tutorials</h2> </div><!-- a-year --> <?php elseif ( is_category('7') ) : ?> <div class="a-year"> <h2>HTML/CSS Tutorials</h2> </div><!-- a-year --> <?php elseif ( is_category('5') ) : ?> <div class="a-year"> <h2>jQuery Tutorials</h2> </div><!-- a-year --> <?php elseif ( is_category('12') ) : ?> <div class="a-year"> <h2>Other Tutorials</h2> </div><!-- a-year --> <?php elseif ( is_category('14') ) : ?> <div class="a-year"> <h2>Photography</h2> </div><!-- a-year --> <?php elseif ( is_category('4') ) : ?> <div class="a-year"> <h2>Photoshop Tutorials</h2> </div><!-- a-year --> <?php elseif ( is_category('6') ) : ?> <div class="a-year"> <h2>PHP Tutorials</h2> </div><!-- a-year --> <?php elseif ( is_category('13') ) : ?> <div class="a-year"> <h2>Wordpress Tutorials</h2> </div><!-- a-year -->
Create an account or sign in to comment