Theme not loading certain div's
-
Need some help on this. In my local version of the site, there are two <div>’s that I’ve added onto a template page for the home page, a flash content div for the flash banner and a div for static image links on the page. These divs load perfectly fine on my local version of the site, but when I uploaded the site onto the live server, for some reason those divs no longer load on the page in question. They’re still in the php code. There are no errors thrown in Chrome’s element inspector. They just don’t show up as if they’re not there, except…they are, and they load perfectly fine on my local version. What gives?
Here’s the link to the site in question: http://www.trysthaircompany.com/home
Here’s what it looks like on my local server: http://oi49.tinypic.com/jpdj5f.jpgAny help would be appreciated, thanks!
-
Your div does load doesn’t it? That is the second time ‘Home’ shows up. The instance underneath he main menu, right?
My guess it that you are loading the flash with the swfobject script and that it is mis-configured. Maybe there a reference to your local server somewhere.
Hi thanks for responding. It does NOT load. I look at the live page in google element inspector (and you can do this too if you’ve got Chrome) and two divs, the top and the bottom, are NOT THERE. It’s as if they’re not even written in the code, even though they are.
So this is what my written code looks like:<div id="flashContent"> <object width="920" height="321" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.trysthaircompany.com/wp-content/themes/tryst/banners.swf" /><param name="wmode" value="transparent" /><embed width="920" height="321" type="application/x-shockwave-flash" src="http://www.trysthaircompany.com/wp-content/themes/tryst/banners.swf" wmode="transparent" /></object> </div> <div class="contentLayoutMain">etc etc. So there’s a div called “flashContent” between the “nav” div and the “content” div in my code. It’s simply not there in the live version. The same goes for the image footer at the end, which looks like this:
<div class="cleared"></div> <div id="footerImages"> <a href="http://www.trysthaircompany.com/?page_id=11"><img src="<?php bloginfo('template_directory'); ?>/images/aboutUs.png" class="homeImg"/></a><a href="http://www.trysthaircompany.com/?page_id=15"><img src="<?php bloginfo('template_directory'); ?>/images/services.png" class="homeImg"/></a><a href="http://www.trysthaircompany.com/?page_id=13"><img src="<?php bloginfo('template_directory'); ?>/images/products.png" class="homeImg"/></a> </div>Again, it’s a div called “footerImages” below the “cleared” div. If you look at the page in element Inspector it shows the “cleared” div and no “footerImages.” These divs both show up in my local version of the site just fine.
Any thoughts? I would assume something is keeping them from loading. I’m not using swfobject, just a good old fashioned object embed for the flash banner, as you can see.
And also, other flash elements load fine on this page:
…I look at the live page in google element inspector (and you can do this too if you’ve got Chrome)…
And that is what I did… with FireFox…
…the top and the bottom, are NOT THERE. It’s as if they’re not even written in the code…
Yes. I know that. It is pretty obvious. My suspicion was that swfobject was replacing your swf with alternate content and…
Any thoughts? I would assume something is keeping them from loading. I’m not using swfobject…
But the swfobject script is loading on the page. Your theme is loading it. That is why I suspected it.
However, whatever is causing this, causes it before the page ever gets sent to the browser– http://www.webpagetest.org/result/120723_F1_XGZ/1/details/ . You can see the same effect with HttpFox. It is the same with your images. ‘products.png’, for example, never gets sent. That means that you have broken code in your source files somewhere. Post all of the problem file to the pastebin.
Here’s a pastebin link for you to the home page template php that’s broken
I don’t think it’s swfobject; I tried using swf object when this problem first came up and it didn’t solve it, so I went back to how I was embedding the swf in the first place, before realizing that the other div with no flash in it wasn’t loading either.
I’m not sure it’s broken code, as the page works perfectly as is in my localhost version on my computer, but let me know if you notice anything, regardless 🙂 I’ve removed the reference to the swfobject.js just in case, although it didn’t fix anything.
The code you posted to the pastebin is not the code for the page at “http://www.trysthaircompany.com/home”. There is no “contentMain” div on your “Home” page and that div is not inside any conditionals in your code. It should show up every time that template loads. Nor does “contentLayoutMain” on your “Home” page. This is not the code for that page. You are not using
body_class()so I can’t tell you what template that is loading, but isn’t the one you think.Are your templates properly assigned to your pages– wp-admin->Pages?
Yes, it’s the code for the home page 😉 That’s the problem. I build this template on my local machine, where the code loads perfectly. I move the same code onto my live site and for some reason it no longer loads the way it’s supposed to. It looks the way you see it in inspector now. You’re absolutely right in that there’s no contentMain or contentLayoutMain. There should be; and there is, on my local site. On my live site, there isn’t.
Here’s a screenshot of the code that’s currently in the home page php on my live site;
http://i47.tinypic.com/2mrftq0.pngFor some reason, that code is being replaced with what looks like the default page template when someone loads http://www.trysthaircompany.com/home, instead of the home page template. (which is why you see content instead of contentMain).
So you’ve definitely made me aware that the entire page is being screwed up somehow, not just these two divs, although I have no idea what’s breaking it. Templates are correctly labelled and assigned, as you can see here:
http://i48.tinypic.com/5xtli9.jpg
So I’m not sure why it’s not pulling in the correct template, especially since this is only in the live version, whereas the local site works just fine and is coded exactly the same.
Right, that is why I asked if “your templates [are] properly assigned to your pages– wp-admin->Pages?” Also check wp-admin->Settings->Reading and make sure those settings match what you have on the working install.
Right; so I linked a shot of the home page Page under wp-admin – > Pages; I’ll show it here again:
http://i48.tinypic.com/5xtli9.jpg
It seems to be linked properly to the correct template page.
Also, the reading settings are perfectly fine; exactly the same as the local version.
I really do appreciate you taking the time to look into this with me; do you have any other idea on what might cause the template to simply not load only on the live version?
Is you template file named “home.php”? That is a reserved file name. It could be causing trouble.a
No. I don’t know why it would work on one server and not the other, assuming roughly equivalent servers.
Soooo I got it working, although the solution was weird, but thanks for your comments cause it led me here 😉 The template page was called page-HOME.php which is totally fine, but the template name was Home, which apparently is what caused problems; as soon as I changed the template name to something else it worked beautifully. Perhaps there’s a server side issue with that specific name for a template page, I’m not really sure. But I renamed both the php file (to page-MAIN.php) and the template name (Main) and it now works fine.
Thanks for taking the time to bounce back and forth with me a bit, you definitely helped! 😀 Appreciate it!
Good. Glad you got it. 🙂
The topic ‘Theme not loading certain div's’ is closed to new replies.