Monday, July 20, 2009

adding links to the top menu

Related articles



Whether you are using the default header or the top navigation (for those who have replaced the standard header with a custom header graphic and activated the top menu), adding links to either the header (in button style) or the top navigation (normal text link style) is the same procedure:

1. Adding links to the header navigation:
Open the header template (header.php) in your editor and find this code:

<div id="headernav">
<ul>
<li><a href="<?php bloginfo('url'); ?>">Home</a></li>
<!- - <li><a href="URL">Link2</a></li> - ->
<!- - <li><a href="URL">Link3</a></li> - ->
<?php
// wp_list_pages(�title_li=&depth=3&sort_column=menu_order�);
// wp_list_categories(�title_li=&depth=3�);
?>
</ul>
</div>

As you can see, the links are simply list items of an unordered list. I have already added two more list items that are commented out, so you only need to remove the HTML comments before ( ) the list items and replace “URL” with the target URL for the link and “Link2″ / “Link3″ with the anchor text for the link.
If you need more links, simply add more list items in the same style.

You can also use categories or pages as links inside the header. To add either your WP pages or your blog categories to the header, simply remove the PHP comment ( // ) before the corresponding line in the code above, i.e.:
wp_list_pages… for pages
wp_list_categories … for categories

Caveat: Because of the drop-down menus, the links inside header / top navigation should not exceed one line or the drop-down menu won´t work.

2. Adding links to the top menu:
Open the top menu template (topmenu.php) in your editor and find this code:

<div id="topmenu">
<ul>
<li ><a href="<?php bloginfo('url'); ?>">Home</a></li>
<!- - <li><a href="URL">Link2</a></li> - ->
<!- - <li><a href="URL">Link3</a></li> - ->
<?php
// wp_list_pages(�title_li=&depth=3&sort_column=menu_order�);
// wp_list_categories(�title_li=&depth=3�);
?>
</ul>
</div>

Proceed in the same way as explained above (see 1.)

0 comments:

Post a Comment

Cah Kampung

ShoutMix chat widget
 

Template by marz