Setup: WordPress v 3.0.4, multisite network enabled, Theme: Twentyten child, local installation with MAMP 1.9.4, PHP 5.3.2, using SUBFOLDERS (not subdomains) for 4 sub sites
Problem: Same global navigation menu, but sub sites construct urls for categories different to urls constructed in main site.
In main site, an instance of a category link in the main navigation menu: —
Note the ‘/blog/’ directory. Selecting the link returns a page with the category’s list of posts. This is as it should be.
Whereas in sub sites, using the same main site navigation menu for global navigation, the link for the same category is constructed differently: —
Note the absence of the ‘/blog/’ directory. Selecting the link returns a 404 page. 🙁
In order to integrate the 4 sub sites together with the main site, I am using the main site’s navigation menu for all by inserting the following code in the ‘header.php’ file for each of the sub sites. All other links on the navigation menu are working sitewide.
<?php /* for main site menu to display globally or sitewide */ switch_to_blog(1); ?>
<?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’ ) ); ?>
<?php /* restore settings for current blog */ restore_current_blog(); ?>
Can it have anything to do with how the ‘Categories’ link was added to the menu? In the Super Admin > Appearance > Menus panel, I created a custom link, typed ‘#’ in the URL field and ‘Categories’ for the label, then added to the menu. Next I added various Categories as children of the custom link.
This problem is due to issue with WordPress insisting on writing a ‘/blog/’ slug into the url. Andrea pointed me to the plugin Remove Blog Slug over at buddydev.com. Downloaded, installed and activated, updated Permalinks, and voila! The urls are now rid of the wretched ‘/blog/’ slug, and even better, now the categories menu is working globally across my network! Problem solved.
- The topic ‘Global navigation: category urls mixup’ is closed to new replies.