admin管理员组文章数量:1245839
I'm currently working with the 2010 theme and want to modify the nav bar so that when you click on a page that is listed on the navbar, it takes you to one of my categories pages (example, clicking on 'swag', will take you to the swag category page). How would I go about doing this? I've included my website:
Here is the code that deals w/ the navbar:
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
</div><!-- #access -->
Thanks for the help.
I'm currently working with the 2010 theme and want to modify the nav bar so that when you click on a page that is listed on the navbar, it takes you to one of my categories pages (example, clicking on 'swag', will take you to the swag category page). How would I go about doing this? I've included my website:
http://www.bro-campus
Here is the code that deals w/ the navbar:
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
</div><!-- #access -->
Thanks for the help.
Share Improve this question asked Jun 26, 2011 at 22:29 TopChefTopChef2 Answers
Reset to default 2Posting this as a separate answer, because it's actually different from this answer.
You do need to create a custom menu, but you do not need to use a custom link.
- Go to
Dashboard -> Appearance -> Menus
- If necessary, Create a new menu
- Add whatever Pages to the menu that you want
- To add a Category, ensure that the appropriate metabox is available:
4.1. Click Screen Options
4.2. Ensure that the Categories is enabled (checked)
- In the Categories metabox, select the Categories that you want to add to your menu, then click
Add To Menu
- Save the menu
- Add the Menu to the appropriate Theme Location, in the metabox in the upper left-hand corner, titled Theme Locations
You shouldn't need to modify the php code to do this, you can set up a custom link in the menu through the wordpress admin, and have it point to the url of your category page.
Specifically, follow these steps in the admin interface:
- Go to
Apperance
. - Click
Menus
. - Under
Custom Links
, enter the URL of your category page, as well as the label for the link. - Click
Add to Menu
.
That should do it.
本文标签: phpWordpress Theme Modification Help
版权声明:本文标题:php - Wordpress Theme Modification Help 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1740220588a2243726.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论