Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

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

PHP include in CSS Inserts


  #1  
Old Apr 6, 2011, 02:35 PM
sawyerjw
 
24 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, 10:35 AM
lmilesw's Avatar
lmilesw
 
10,176 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, 08:18 PM
sawyerjw
 
24 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, 09:29 PM
lmilesw's Avatar
lmilesw
 
10,176 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, 09:40 PM
sawyerjw
 
24 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, 09:59 PM
lmilesw's Avatar
lmilesw
 
10,176 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, 10:06 PM
sawyerjw
 
24 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, 04:41 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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, 07:32 AM
sawyerjw
 
24 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, 12:09 PM
sawyerjw
 
24 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, 02:41 PM
lmilesw's Avatar
lmilesw
 
10,176 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 12: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 03:57 PM
[SOLVED] PHP code in HTML / CSS Inserts. MickR Header configuration & styling 2 Aug 12, 2010 02:47 PM
ADD HTML/CSS Inserts -- 3.5.1 --- Need to remove default CSS Inserts ortho New Versions, & Updating 0 Jun 23, 2010 03: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 05:41 PM


All times are GMT -6. The time now is 02:04 AM.


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