Support » Networking WordPress » Theme for a multisite

  • Hi

    We want the ability to give each of our users who have a website on our multisite install to easily customise the look/feel of their own site. However, it should have our standard logo and footer across all sites on the multisite.

    Is there a good theme that would help us with this?

    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • DJ

    (@itsjustdj)

    You can use any theme for a multisite. Here’s a great rundown on building multisites: https://www.bluehost.com/blog/how-wordpress-multisite-works-a-helpful-guide

    Thread Starter dl292

    (@dl292)

    Thanks @itsjustdj . My question was worded very poorly! 🙂

    What I meant to say/ask was:

    We want the ability for users to create their own sites using a good selection of themes that will be preinstalled on our WPMS. And even for the user to add their own theme.

    However, all preinstalled themes AND any new themes should have consistent branding across the top and bottom.

    My question: Is there a way this can be achieved without having to manually edit each themes’ header/footer files?

    Perhaps: in the core WPMS files there is a functions.php that could inject some simple html at the beginning and ending of the <body> tag of every theme used in our WPMS installation?

    Thanks

    DJ

    (@itsjustdj)

    With a multisite, you can only use one theme across all the sites. The users of each site can do whatever they want to their own site using that theme. So you would need to monitor them to make sure they all retain the branded header/footer you want and not mess with that.

    The article answers a lot of questions about multisites.

    What I’ve done is add a few themes to my multisites that I like figuring those could be used by anyone else creating a site on those multisites. You could add a bit of code to the footers and/or headers reflecting your information, link, and logo to the themes you offer.

    There have been a few times when I’ve needed to create a child theme specifically for a certain site… That change you’ve made to the base theme should still work within those child themes.

    Keep in mind a clever user who knows the CSS codes can use the customizer to remove or hide your added text, links, and logos. I wouldn’t police my users for that but you might make that part of your TOS.

    Also, Turnkey Linux adds a ‘colophon’ to their system that shows on any theme. You might look at how they do that for some inspiration. I’ve never looked at that code myself as I kind of like that line of info.

    Thread Starter dl292

    (@dl292)

    Hmm. I think Ive found a solution. Its a bit heavy-handed, but should do the job.

    Recent versions of WP have specific hooks for scenarios such as this, but it relies on themes having those hook in their header/footer files. (A random check shows that even the latest versions of themes Ive selected dont have these hooks).

    So, my solution is to use WP’s wp_footer() hook (which any self-respecting theme would have) and use jquery to prepend/append html code to the body tag.

    The code if youre interested is:

    // Prepend/append code to body tag.
    add_action( 'wp_footer', 'body_code' );
     
    function body_code() {
        $code = '<script>(function($){$("body").prepend("<p>Opening body</p>");$("body").append("<p>Closing body</p>");})(jQuery);</script>';
    	echo $code;
    }

    Do you see any downsides to this?

    Is it possible to add this to a Multisite functions.php so it cascades to all minisites?

    Thanks

    DJ

    (@itsjustdj)

    If you add code to the functions.php as the Super User, then yes, it’s shared with all the other sites.

    I’m not sure why you’re going this complicated route, though. Why not just set everyone up with the same footer and instruct them not to change it? Much simpler, and you don’t have to mess with functions.php.

    However, if you do decide to go that route, you should really create a child theme before changing functions.php.

    Thread Starter dl292

    (@dl292)

    Ah cool, thats good to know about the functions.php file cascading to sub sites.

    The reason why I dont want to make direct edits to the various themes header/footer files is because I need this setup to be as hands-off as possible. We may have users that want to add their own themes etc… and I dont want to have to manually make edits to these. (IE: create a child theme, edit the header/footer files etc…). Also, if theres a change needed to the ‘all-encompassing header/footer’ then I just want to edit it in one place, and have that reflected across every website.

    Or perhaps Im misunderstanding you(?). Is there another/better way to have a standard header/footer across all sub sites without having to edit all of the themes headers/footer files?

    Thanks

    DJ

    (@itsjustdj)

    I believe the only way is to write a plugin for it.

    BTW – I misrepresented what I said earlier about each site having it’s own theme. They can, but only if you (the Admin) enable it for them. Sorry about the confusion there.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Theme for a multisite’ is closed to new replies.