A Digital Age Deserves A Digital Leader

WordPress CSS Help (Resolved)

WordPress CSS Help (Resolved)

Postby gries818 » Mon May 07, 2007 1:14 am

With the help of PRO I devised some code awhile back (in JavaScript) to detect the screen resolution and dish up a custom CSS file for that Resolution. Works great (view <a href="http://www.pro-networks.org/forum/viewtopic.php?t=82436">HERE</a>).

The problem I am experiencing comes from WordPress. I've decided that it is time to update my Theme so that it supports multiple resolutions (with the Javascript code I've already written). However, WordPress seems to have other ideas.

For some reason, the only way that it displays CSS is with this code:

Code: Select all
<style type="text/css" media="screen">
      @import url( <php> );
   </style>


The problem is that is the only way to display any stylesheet. You can't use (phpBB deleted the rest of the stylesheet code below):

Code: Select all
<link>
.

Which is the output of the script. How do I get around this?
Last edited by gries818 on Mon May 14, 2007 8:47 pm, edited 2 times in total.
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Postby JMacalinao » Mon May 07, 2007 10:33 am

Have you tried changing the code from something like

Code: Select all
document.writeln('<link>')


... to:

Code: Select all
document.writeln('<style type="text/css" media="screen">@import url( {CSS url here} );</style>')


Basically, the two things are the same thing, but if one method doesn't work, the other one should. I think the other one doesn't work because WordPress forbids the link tag. Probably for higher HTML standards.
<a href="http://www.vrve.net" target="_blank">JMacalinao </a>|{music}I wanna be happy! ^_^
<a href="http://www.vistamania.org/" target="_blank"><img src="http://img382.imageshack.us/img382/2026/vistamania35zu.gif" border="0"></a>
PRO Level 13
Posts: 671
Joined: Sat May 08, 2004 8:52 am
Location: Philippines

Postby gries818 » Mon May 07, 2007 8:00 pm

so i can write the code like this:

Code: Select all
@import url( {style1.css} );


???
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Postby JMacalinao » Mon May 07, 2007 11:38 pm

Remove the brackets :lol:

Code: Select all
@import url(style1.css);
<a href="http://www.vrve.net" target="_blank">JMacalinao </a>|{music}I wanna be happy! ^_^
<a href="http://www.vistamania.org/" target="_blank"><img src="http://img382.imageshack.us/img382/2026/vistamania35zu.gif" border="0"></a>
PRO Level 13
Posts: 671
Joined: Sat May 08, 2004 8:52 am
Location: Philippines

Postby gries818 » Tue May 08, 2007 12:44 am

The only way I can get any style to work is by using the original code.

It wants to ask WordPress and only use the stylesheet wordpress wants in to. It only works if you use the stylesheet that is the 'default' one (with the code that I gave at the top of the post.
Image

Mac OS 10.6.7 - Personal
Ubuntu Server 11.04 - Server
Software Development
User avatar
Posts: 3991
Joined: Wed Jul 07, 2004 6:28 pm

Return to HTML, CSS, and Scripts

Who is online

Users browsing this forum: No registered users and 3 guests