• For the menu I want to show some main categories not pages, this is the current header code to show the pages:

    <?php
            $menupages = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'publish' AND post_parent = 0 ORDER BY menu_order ASC");
            $menupagesnumber = count($menupages);
    		$menupagescount = 1;
    		foreach ($menupages as $menupage) :
            ?>
    	        <li
    			<?php
    			if (is_page($menupage->ID) && $menupagescount!=$menupagesnumber ) {
    				echo ' id="current"';
    			}
    			if ($menupagescount==$menupagesnumber) {
    				echo ' class="last"';
    			}
    			if (is_page($menupage->ID) && $menupagescount==$menupagesnumber) {
    				echo ' id="lastcurrent"';
    			}
    			$menupagescount++;
    			?>>
                <a href="<?php echo get_permalink($menupage->ID); ?>" title="<?php echo $menupage->post_title; ?>"><?php echo $menupage->post_title; ?></a></li>
    
    		<?php endforeach; ?>

    Whats changes are needed to get categories instead.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Show Categories not Pages’ is closed to new replies.