最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Wordpress Theme Modification Help

programmeradmin2浏览0评论

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 TopChefTopChef
Add a comment  | 

2 Answers 2

Reset to default 2

Posting 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.

  1. Go to Dashboard -> Appearance -> Menus
  2. If necessary, Create a new menu
  3. Add whatever Pages to the menu that you want
  4. 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)

  1. In the Categories metabox, select the Categories that you want to add to your menu, then click Add To Menu
  2. Save the menu
  3. 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:

  1. Go to Apperance.
  2. Click Menus.
  3. Under Custom Links, enter the URL of your category page, as well as the label for the link.
  4. Click Add to Menu.

That should do it.

发布评论

评论列表(0)

  1. 暂无评论