Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

PHP include in CSS Inserts


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Apr 6, 2011, 03:35 PM
sawyerjw
 
22 posts · Dec 2010
Eastern PA, USA
I like to edit my custom CSS as a separate file and include it in the HTML/CSS inserts section with a line similar to the following:

PHP Code:
include_once get_template_directory_uri() . '/custom.css'
This works great on my web host. One of my clients has a site hosted by the same web hosting company and the above does not work on his site. To get the custom CSS to be recognized on his site, I have to copy the contents of 'custom.css' and paste it into the HTML/CSS inserts section in place of the above insert.

Obviously, there's something different about his account, but I've yet to figure it out. Has anyone encountered this and found a solution for it?

WP version is 3.1.1
Atahualpa version is 3.6.4

Thanks,

John
  #2  
Old Apr 7, 2011, 11:35 AM
lmilesw's Avatar
lmilesw
 
10,110 posts · Jul 2009
Central New York State USA
Why not just put something like the following in the CSS Inserts: Header box and put your style sheet in the root folder of your site or change the path and put it anywhere you want?
HTML Code:
<link rel="stylesheet" type="text/css" href="custom.css" />
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #3  
Old Apr 7, 2011, 09:18 PM
sawyerjw
 
22 posts · Dec 2010
Eastern PA, USA
Hi, Larry,

Thanks for the response. You're right, that seems a much more straightforward way of doing it. It works fine on my server. Now to try the customer's site...

It still baffles me that my original method works on one server but not another. Assuming your suggestion works on the client's site, though, it shall remain a mystery.

Thanks, again,

John
  #4  
Old Apr 7, 2011, 10:29 PM
lmilesw's Avatar
lmilesw
 
10,110 posts · Jul 2009
Central New York State USA
There were some changes make to the theme code in later versions because of some requirements by WordPress which cause problems with some code.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #5  
Old Apr 7, 2011, 10:40 PM
sawyerjw
 
22 posts · Dec 2010
Eastern PA, USA
Hi, Larry,

Well, both the development site on my server and the client's site were created from the same download of Atahualpa 3.6.4, so they are identical in that regard. Whatever's causing the problem is likely a server configuration issue of some kind. I have noticed that despite us both being on the same hosting company, his account is set up differently than mine. Mine is considerably older than his, which is likely why.

In any case, I noticed that when I implemented your suggestion the resulting link showed up near the top of the source code in the above site (v3.6.4). I did the same thing on another site running Atahualpa 3.5.3 and the link showed up just above the ending head tag after all the generated CSS code, etc. That brings up a question.

Some of the custom.css code overrides styles in plugins and/or areas of Atahualpa that aren't addressed in the theme options. That being the case, I would think I would want it at the bottom of the header after all the other CSS due to the "cascading" nature of CSS. Perhaps this shows my ignorance of CSS, but it would seem that things would work differently depending on whether the custom.css link is at the top of the head area or the bottom of it, or more accurately whether it appears before or after the CSS it's intended to override.

What am I missing?

Thanks,

John
  #6  
Old Apr 7, 2011, 10:59 PM
lmilesw's Avatar
lmilesw
 
10,110 posts · Jul 2009
Central New York State USA
There are rules for CSS precedence such as you mentioned in that a rule that comes later in a style sheet will override an earlier one. Inline styling will override that as well as style set in the header of the page. etc etc. Plus you can use !important after CSS code to jump it to the top but of course if you have two items in the same style sheet with !important after them the later will take precedence.

I say all this to say that I don't think too much about precedence as it makes me crazy. I use Firebug with Firefox to do some virtual testing and use what works. Since I have worked with this stuff for awhile I sort of know what will and won't work but I don's spend a lot of time thinking about whether to put something here or there.

As for why you are seeing differences in the different version of Atahualpa I am not sure except to say there have been coding changes for bug fixes and to comply with guidelines set by WordPress.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #7  
Old Apr 7, 2011, 11:06 PM
sawyerjw
 
22 posts · Dec 2010
Eastern PA, USA
Hi, Larry,

I hear you regarding CSS precedence. A lot about CSS causes my head to hurt. :-)

For whatever reason it seems to be working as expected on my test site despite the apparent contradiction. I'll try it on the client's site tomorrow or over the weekend and see what happens.

I use Firebug/Firefox, as well. I don't know how I lived without it. :-)

Thanks,

John
  #8  
Old Apr 8, 2011, 05:41 AM
juggledad's Avatar
juggledad
 
22,326 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
One other thing. Just because you have two sites at a host, doesn't mean they are on the same server. They could be on two different boxes which are configured differently. I have seen this at my own host.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #9  
Old Apr 8, 2011, 08:32 AM
sawyerjw
 
22 posts · Dec 2010
Eastern PA, USA
Yes, I understand that the chances of two accounts on the same host being on the same server are virtually nil, especially when one account is years older than the other. Evidently, the "standard" configuration has evolved and they haven't gone back and retrofitted the older servers, which is probably just as well.

Thanks,

John
  #10  
Old Apr 8, 2011, 01:09 PM
sawyerjw
 
22 posts · Dec 2010
Eastern PA, USA
Hi, Larry,

I just discovered that inserting the HTML link tag in the Header section caused a bit of heartburn in the site running 3.5.3. An override of the list-style-image property of the li tag on posts disappeared. Putting the custom.css back as an include at the bottom of CSS inserts fixed it.

Given that the 3.5.3 code puts the custom.css link at the bottom of the head section, I would have expected the override to work, but obviously it's backward from my expectation.

Another thing I noticed is that changes made to custom.css are instantaneous on page reload with the include, but require a Ctrl-F5 reload with the link.

So, bottom line, when the include works correctly, it's preferable (for me) to the link technique.

Thanks,

John
  #11  
Old Apr 8, 2011, 03:41 PM
lmilesw's Avatar
lmilesw
 
10,110 posts · Jul 2009
Central New York State USA
This could be Suhosin related. The include works fine for me as well.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
why Fields in the Atahualpa 3.3.3 does not expand? css inserts, html inserts krystyna New Versions, & Updating 3 Oct 28, 2010 01:22 PM
[SOLVED] 3.5.3 Default text in ATO&gt;Add HTML/CSS Inserts&gt;CSS Inserts boris_mcnorris New Versions, & Updating 4 Oct 16, 2010 04:57 PM
[SOLVED] PHP code in HTML / CSS Inserts. MickR Header configuration & styling 2 Aug 12, 2010 03:47 PM
ADD HTML/CSS Inserts -- 3.5.1 --- Need to remove default CSS Inserts ortho New Versions, & Updating 0 Jun 23, 2010 04:17 PM
[SOLVED] why Fields in the Atahualpa 3.3.3 does not expand? css inserts, html inserts ppat2 New Versions, & Updating 3 Jun 2, 2009 06:41 PM


All times are GMT -6. The time now is 04:44 PM.


Powered by vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.