March 1, 201016 yr Hello friends, In my blog if i want the categories to apeear at the top navigation where the pages are and the pages in the categories area can it be done this is navigation code <div id="nav"> <div class="search"><?php include (TEMPLATEPATH . '/searchform.php'); ?></div> <!-- Closes Search --> <?php function get_the_pa_ges() { global $wpdb; if ( ! $these_pages = wp_cache_get('these_pages', 'pages') ) { $these_pages = $wpdb->get_results('select ID, post_title from '. $wpdb->posts .' where post_status = "publish" and post_type = "page" order by ID'); } return $these_pages; } function list_all_pages(){ $all_pages = get_the_pa_ges (); foreach ($all_pages as $thats_all){ $the_page_id = $thats_all->ID; if (is_page($the_page_id)) { $addclass = ' class="current_page"'; } else { $addclass = ''; } $output .= '<li' . $addclass . '><a href="'.get_permalink($thats_all->ID).'" title="'.$thats_all->post_title.'"><span>'.$thats_all->post_title.'</span></a></li>'; } return $output; } ?> <ul> <?php if (is_home()) { $addclass = ' class="current_page"'; } else { $addclass = ''; } echo "<li" . $addclass . "><a href='" . get_option('home') . "' title='Home'><span>Home</span></a></li>"; echo list_all_pages();?> </ul> <div class="cleared"></div> </div> <!-- Closes Nav --> and this is the categories code in sidebar.php <ul><li> <h2>Categories</h2> <ul> <?php wp_list_categories('show_count=0&title_li='); ?> </ul> </li> </ul> my bloglink
March 1, 201016 yr Author Why don't you just swap the codes? but i have many categories how will that fit at the top? thats my concern or do i need a seperate function for categories? just found this tutorial oncategories dropdown
March 1, 201016 yr If you have more than 4 top level categories, I recommend doing a drop-down menu. The tutorial you've found will do.
Create an account or sign in to comment