0

I am using iFrame to call common footer and header into a muti-site wordpress but the header and footer load much later than the rest of the site. Here is what I have for the footer:

<iframe scrolling="no" height="395px" frameborder="0" width="100%" src="http://domain.com/common-footer/" class="footer-frame"></iframe>

Is there a better way to do this or to improve this? Thanks much.

3
  • Uhm, PHP comes to mind, and especially the built in methods in Wordpress for actually including headers and footers ? Commented Nov 15, 2014 at 1:25
  • Well, trying to share the main's header and footer dynamically with other sites/themes in wordpress and my developer came up with this "iFrame" solution. Now that I see the delay in loading, I'm trying to see if it can be improved somehow. Commented Nov 15, 2014 at 1:31
  • Your developer sucks, find someone else or read the Codex yourself and learn how it should be done, this is all built in ready to go -> codex.wordpress.org/Stepping_into_Templates Commented Nov 15, 2014 at 1:33

1 Answer 1

0

You could do this easily with jQuery with the .load() function. Use it like this:

<script> 
$(function(){
  $("#header").load("header.html"); 
  $("#footer").load("footer.html"); 
});
</script>

HTML:

<div id="header"></div>
<!--Remaining section-->
<div id="footer"></div>

For more information about the .load() function: http://www.jquery-tutorial.net/ajax/the-load-method/

Hope this helps!

Sign up to request clarification or add additional context in comments.

4 Comments

Sorry, I'm a learner... So I will need to place the literal location of the header/footer in that script...right? like: "domain.com/common-footer"
Do you need additional help? How can I help? At your service.
I need to call commen-footer.php into footer of a site. Will this work in that format you presented?
Yes, you can make it do something like that: stackoverflow.com/questions/17257436/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.