• Hi, I am a css & html person but I don’t know PHP. I want to change the code in my header.php file to use one stylesheet for screen and another for mobile devices, can someone please help me out with exactly what code I would put there?

    In my normal htm pages on my site I have this code:

    ‘<meta name=”viewport” content=”width=device-width, initial-scale=1.0, maximum-scale=2.0, user-scalable=yes” />
    <link media=”Screen” href=”style.css” type=”text/css” rel=”stylesheet” />
    <link media=”handheld, only screen and (max-width: 620px), only screen and (max-device-width: 620px)” href=”mobile.css” type=”text/css” rel=”stylesheet” />
    <!–[if IEMobile]>
    <link rel=”stylesheet” type=”text/css” href=”mobile.css” media=”screen” />
    <![endif]–>’

    How would I translate this code to use in my wordpress blog header?

    Thank you for any help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can put html code into a php file — if you look at the header.php file — it has regular html code already — including for stylesheet links. Just be sure it is not inside any php tags. You should be able to replace the existing links with what you want.

    But only make changes in a Child Theme — don’t change any core files, especially in the default theme.

    You just need to worry about the links to your stylesheets.

    <link media="Screen" href="<?php bloginfo('template_directory'); ?>/style.css" type="text/css" rel="stylesheet" />

    Everything else stays the same. I would advise looking at the codex in terms of the structure of a theme however if you are building a custom theme.

    Thread Starter wordpressn00b77

    (@wordpressn00b77)

    Thanks very much for the help!

    I had been editing the theme files but I took your advise and set up my own child theme and have it working now.

    I have one more dumb question about the PHP. Do I remove that snippet of PHP from the header file and replace it with my html? Or do I just add my html to the header.php file?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP person help me with stylesheet code?’ is closed to new replies.