I am working on my first serious WordPress MU installation in a couple of years, and I came across an interesting question: How do I use the main home page navigation across all blogs? Basically, I need the main navigation to be the same on every blog.
After some research, I came upon this discussion thread on the WordPress forums. In the thread, you will see all sorts of different solutions proposed from plugins to hooks. The simplest solution that I found is to include the following in your sub-blog’s “header.php” file:
<?php switch_to_blog(1); ?>
<?php wp_list_pages('title_li='); ?>
<?php restore_current_blog(); ?>
This code temporarily switches back to the main blog’s information, pulls the main navigation, then switches back to the current blog. Pretty nifty!
2 Comments
More posts from themightymo.com
How to Connect a GoDaddy Site to ManageWP
GoDaddy owns ManageWP, and, strangely, they make it very difficult to add GoDaddy-managed WordPress sites to their ManageWP service. Thankfully, there’s a quick workaround: Visit https://yoursite.com/wp-admin/plugins.php?showWorker=1 — This will make the ManageWP “Worker” plugin visible. Copy the connection info from the ManageWP Worker plugin. Add the site per-normal on ManageWP. That’s it! I hope this…
How to check if your current page is the wp-login.php page
I realized this morning that my TMM Maintenance Mode WordPress plugin had a bug that was causing the wp-login.php page to be inaccessible. The solution was to write a simple function that checks whether or not we’re currently on a login page, and then add a call to that function in my code. Here’s the…
WooCommerce Product Image Gallery Not Loading with WP Rocket Active
Today I updated a WooCommerce site, and everything worked fine, except for the images on product pages – they were not displaying at all. After a lot of trial & error, I realized that WP Rocket was to blame. I’m not sure exactly what the issue was (though my hunch is that it had to…
Wow. That function could open up a number of possibilities for cross blog sharing. Good tool for the toolbox.
I was actually trying to find a way to do that on an install recently (without hard coding the page urls)
Thanks
@Carl – Glad to be of service. 🙂