Technology – Wordpress – Free Wordpress Themes


How to make Wordpress categories & pages into horizontal menu

Posted By steve soe

Some of my readers asked me how I created my horizontal menu using Wordpress WP-Categories & WP-Pages. The short answer is — I added the following two code in header.php page.

<?php wp_list_pages(‘title_li=&depth=1&exclude=’); ?>  /* For Pages */

<?php wp_list_categories(’sort_column=name&sort_order=asc&style=list&children=true&hierarchical=true&title_li=0′); ?>   /* For Categories */

Most of the Wordpress Themes have CSS tags for menu bar in header.php. So, the above two code can be put in these menu tags. Here is the example —

<div id=”menu”>
<ul>
<licurrent_page_item”; } ?>”><a href=”<?php echo get_settings(‘home’); ?>”>Home</a></li>

<?php wp_list_pages(‘title_li=&depth=1&exclude=’); ?>
<?php wp_list_categories(’sort_column=name&sort_order=asc&style=list&children=true&hierarchical=true&title_li=0′); ?>

</ul>
</div>

  • Share/Bookmark

Leave Comment