Multisite Slug question — simple but complex?
-
Is there any way to retrieve the main subsite slug?
Here’s what I’m trying to do exactly… I have https://website.com set up as a multisite for SEO purposes, and created subsites:
https://website.com/ — global site
https://website.com/san-diego/ — san diego store
https://website.com/los-angeles/ — los angeles store
https://website.com/denver/ — denver storeNow, each of these subsites has a navigation structure that’s part of the template. They’re called through a php include() function for the sake of maintaining graphics, classes, and styles universally (so using the wp_list_pages is no good). Also, I only want to use one template file (header.php).
THE PROBLEM I’m facing is figuring out how to add the main multisite slug into the links. So let’s say we’re on the Global site (https://website.com/), right now we get this:
<li><a href="/services/p1">Service 1</a></li> <li><a href="/services/p2">Service 2</a></li> <li><a href="/services/p3">Service 3</a></li> <li><a href="/services/p4">Service 4</a></li>
Which is great… but once we get onto the San Diego site (https://website.com/san-diego/), we want this:
<li><a href="/san-diego/services/p1">Service 1</a></li> <li><a href="/san-diego/services/p2">Service 2</a></li> <li><a href="/san-diego/services/p3">Service 3</a></li> <li><a href="/san-diego/services/p3">Service 4</a></li>
<li><a href="<?php multisite-slug; ?>/services/p1">Service 1</a></li>
…and similar for Los Angeles, Denver, etc.. Any great method to achieve this? Hopefully this is pretty clear for what I’m asking for.
- The topic ‘Multisite Slug question — simple but complex?’ is closed to new replies.