Jump to content


Photo
- - - - -

Multisite - Serving The Same Header And Footer Content On Multiple Child Themes?

Multisite child theme master theme multisite pagelines framework base theme same header same footer

  • Please log in to reply
10 replies to this topic

#1 davemoppert

davemoppert

    Super Member

  • Members

  • 146 posts
  • Country: Country Flag

Posted 09 November 2012 - 08:08 AM

I have a multisite wordpress install using the Pagelines Framework theme. I have created two child themes for Pagelines -- one for the parent site and one for the sub sites. I am trying to get the sub sites to display the same header and footer content as the parent site. Because Pagelines populates it's header and footer content dynamically based on Pagelines settings for each site (and not hard coded), is there any way to serve the header and footer content from the parent site to all of the sub sites?

Anyone got an idea on how to accomplish this?

The parent site (using pagelines child theme: kid 2 kid) is here:

Please Login or Register to see this Hidden Content


the test subsite (using pagelines child theme: kid 2 kid stores) is here:

Please Login or Register to see this Hidden Content



My logic is that there might be some code I can add to a header.php file for the /test child theme that will display the header content from the parent site... Open to ideas!

Thanks!


  • adminplp likes this

#2 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 28 November 2012 - 04:39 PM

I'm not sure if this is going to work, but it doesn't hurt to try this plugin:

Please Login or Register to see this Hidden Content



#3 dokether

dokether

    Advanced Member

  • Members


  • 30 posts
  • LocationEdmonton, AB
  • Framework Version:2.4.2
  • Country: Country Flag

Posted 29 November 2012 - 04:40 PM

My recommendation would be that, instead of coding into a header.php file and possibly messing up Pagelines, use the appropriate hooks:

 

Please Login or Register to see this Hidden Content

Please Login or Register to see this Hidden Content

To use these, you would do something like this:

Please Login or Register to see this Hidden Content

That would output an <h1> with the word "Test" in it at the very bottom of the website. Then you would just change the 'pagelines_after_footer' and 'myfunct' to reflect the pagelines_before_site hook and whatever you wanted for the function name. This would allow you to have whatever is included in the functions automatically included in the header/footer of every site.



#4 davemoppert

davemoppert

    Super Member

  • Members

  • 146 posts
  • Country: Country Flag

Posted 30 November 2012 - 01:57 AM

Hi dokether,

 

I thought about hard coding hooks right into the functions.php file for the child theme, but I would like the content in the header and footer to populate dynamically -- so if the admin changes the header (with the navigation and branding) on the parent site, that change would reflect on all the sub sites dynamically.  I don't want to hard code in the header and footer on the base theme for the subsites because I am trying to make this site as turn key as possible for the client when I deliver it.

 

I am using child theme for the parent theme and a separate child theme for the subsites.  

 

Catrina, I will try out that plugin and respond with the outcome.  Thanks for the heads up about it.  

 

Thanks for the response guys!



#5 dokether

dokether

    Advanced Member

  • Members


  • 30 posts
  • LocationEdmonton, AB
  • Framework Version:2.4.2
  • Country: Country Flag

Posted 30 November 2012 - 05:48 AM

Well, the thing is that you can still do that the way I shared. Instead of putting your code into the function() though, you could simply do an include.

 

Let's say you have your header and footer in a directory structure like this:

Please Login or Register to see this Hidden Content

 

Then you could have your hook called in your functions.php for your child themes as such:

Please Login or Register to see this Hidden Content

I haven't tested it out, but that should work. Then you would be able to edit just global_footer and global_header php files anytime you want to update the header/footer.



#6 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 30 November 2012 - 04:45 PM

There is of course a far easier way ;)

 

Wordpress has a secret folder called mu-plugins, if you add it to wp-content and put a php file in there wordpress will auto run it, no need to activate and it runs on every site! mu is Must Use.

 

So add your footer action in there and it'll run on every site.



#7 davemoppert

davemoppert

    Super Member

  • Members

  • 146 posts
  • Country: Country Flag

Posted 01 December 2012 - 06:05 PM

Thanks guys!  It is now obvious there are a number of ways to hard code a Header and Footer on all the subsites -- If I am understanding correctly, all of these ways require me to hard code the header and footer. That would be all fine and dandy except - I am wondering if there is a solution that will pulll the header and footer content from the parent site dynamically.  The only reason I am wondering this is because the menu on the parent site (which is located in the header and footer) will most likely change regularly.  I would love for when the client makes those updates to the menu (from the parent site), the menu options in the header and footer on all the subsites will change dynamically as well.  I am trying to make the site as turn key as possible for the client and would like the navigation menu to be editable via the admin panel of the parent site.

 

If I am understanding correctly:

 

dokether - I think I am following, but it seems this solution I would have to hard code the header and footer right? Is there any way to reference the menu navigations from the parent site dynamically

 

catrina - tried out the plugin.  It's pretty cool but unfortunately, I have to hard code HTML for the header and footer still... Is there any way to reference the menu navigations from the parent site dynamically

 

Simon_P - I have never heard of mu-plugins... not sure how to implement the header and footer from the parent site on all the subsites using Must Use.  Can you clarify?

 

I think we are close... I feel like there has to be a way to do this, but am just not well enough versed in all that is wordpress :)



#8 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 01 December 2012 - 06:09 PM

This would insert a comment into the <head> of every site.

Please Login or Register to see this Hidden Content



#9 davemoppert

davemoppert

    Super Member

  • Members

  • 146 posts
  • Country: Country Flag

Posted 01 December 2012 - 06:29 PM

Simon_P - I could totally add this code in the the functions.php file of the child theme for all the subsites, but I would still have to hard code the menu in the header right?  Is there some code that I can use that will serve up the navigation menu from the parent site OR do I just have to hard code it and manually change the code in this function every time there is a change in the menu (which is what I am trying to avoid)? I am trying to make the site as turn key as possible for the client and would like it when ever the navigation menu is changed (via the wordpress admin panel on the parent site) those updates are served up dynamically on all the subsites (without me having to change the code every time).

 

Is there a solution for this?



#10 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts
  • LocationDevon
  • Framework Version:2.1.1
  • Country: Country Flag

Posted 01 December 2012 - 06:33 PM

You want the menu the same on all subsites? How will a user navigate from inside the subsite if the menu links are all for the parent site?



#11 davemoppert

davemoppert

    Super Member

  • Members

  • 146 posts
  • Country: Country Flag

Posted 01 December 2012 - 07:02 PM

Yeah, so it will display the header and footer of the parent site before and after the subsite content.  I still want the subsite to have it's own menu, it will just not be the primary menu... does that make sense? Here is a screen cap to illustrate what I hope to accomplish:

 

WebsiteSUBSITES1.jpg







Also tagged with one or more of these keywords: Multisite, child theme, master theme, multisite, pagelines framework, base theme, same header, same footer