• Resolved Erik

    (@polder)


    Hi,

    My situation is as following.
    I have a WPMU for a school which has school in different cities.
    Every city has it’s own blog in a WP-network.
    Every school has a dedicated person which will manage the information for only his/her own school.
    Now to my question: Is there a way to have common information (static pages) to show up on every blog site? Which this certain dedicated person is not able to edit.

    So I will have a main menu with like “Our Profile”, “Policy” aso. But the mainpage is editable.

    Now, I can make those pages for every site. But when I have to edit something I have to do it in all 15 pages all over the network.

    Anyone who can give me a solution or at least a hint how to achieve this?

    All the best,
    Erik – sweden

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi Erik,

    First, I’d be aiming to store these pages in one central place, rather than 15. It’s more efficient, and it seems more logical, given that the individual site clearly don’t own their content.

    One relatively simple way might be:
    – create the static pages in a separate site, to which the individual school admins don’t have access
    – create permanent links to them in the themes used by the individual schools

    Thread Starter Erik

    (@polder)

    Hi!

    Thanks for your reply.
    I was thinking about that solution already. And I think it will do to start with.

    Maybe I will dive into making an plugin and do some kind of approach from there. But now I made a site called about-our-schools and will put in static pages.
    On every school I will then create a meny and direct link to those pages.

    Or is there maybe a way to make 1 meny and use this as sidebar och mainmenu on those subsites?

    Thanks again for your reply.

    //Erik

    Thread Starter Erik

    (@polder)

    Well here’s the deal. This earlier mentioned solutions doesn’t apply on my system because of following reason.

    1) An administrator must be able to edit the menu and it’s content pages hooked to it
    2) When browsing to a page in the “shared menu” will transfer the visitor to the blog for main content.

    I still haven’t found a good solution for this function. I would love to see a way where I just can say on the theme header.php to include the menu from blogID 1 (or what ID is relevant). Then all the menus will get updated when the administrator adds a page or move the menu objects around.

    About the content it would be lovely to see a way to stay on the blog and view the content of the shared info blog… Maybe making a page_shared.php theme page will do the job though… But how can I get content from another blog??

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    1) An administrator must be able to edit the menu and it’s content pages hooked to it

    Well that can be done in the WordPress Menu settings (Appearance -> Menu) – You could use New Blog Defaults or other similar plugins to force them on all new blogs, and then the admins per-blog could edit them if they had to.

    2) When browsing to a page in the “shared menu” will transfer the visitor to the blog for main content.

    Well… Yes. That. The problem is WordPress MultiSite was envisioned and built around the concept that you are running multiple separate sites (like WordPress.com). There isn’t supposed to be ‘sharing’ of data like you’re envisioning, so any way you write it with blog switching is pretty inefficient.

    If I needed content to appear on multiple sites, I’d make an mu-plugin that created a short code. Like say I wanted an about page on every site: [aboutpage] is the code and that would call an include of my aboutpage.txt file.

    Of course, they could still edit the page and nuke the short code.

    Right here:
    https://wpmututorials.com/plugins/networkwide-menu/

    All subsites must use themes that have the custom menu feature built in. This is how they did it at the University of Mary Washington site.

    Thread Starter Erik

    (@polder)

    thanks for your reply!

    I have solved the issue this way:

    //Get the current blogID
    global $blog_id;
    //Specify an array holding which blogs the menu has to show up
    $blogs = array('9','10','11','12','13','14','15','16','17','18');
    if(in_array($blog_id, $blogs)){
    	//Remember the current blog_id
    	$current_blog_id = $blog_id;
    
    	//switch to the main blog which you want to get the menu from
    	switch_to_blog(5);
    
    	//output the WordPress navigation menu
    	wp_nav_menu( array( 'theme_location' => 'primary' ) ); 
    
    	//switch back to the current blog being viewed
    	switch_to_blog($current_blog_id);
    
    }else{
    	//If you're not visiting one of those blog which have shared menu show the blog menu instead.
    	wp_nav_menu( array( 'theme_location' => 'primary' ) );
    }

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Huh. Andrea, I did not realize it kept the local-site formatting though. I mean, the menu’s the easy part. Keeping the look and feel per site is the trick./

    Thread Starter Erik

    (@polder)

    Yes I know.
    But in my case that isn’t an issue because all sites use the same theme and format.
    So I just let the user switch to the blog which belongs to the menu.

    But as you pointed out above for other situations this solution won’t do the job….

    While this solution works for your situation, for a site with a LOT of blogs, using switch_to_blog on the front end will wind up being resource intensive.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘General pages for multisite’ is closed to new replies.