• I am trying to use two different style-sheets. One for the whole page, and a separate style-sheet for the shop page.

    I am new to php and I tried using this if else statement at the header, that does actually work but backwards.

    <?php if( is_page(‘shop-2’) ) :?>
    <link rel=”stylesheet” type=”text/css” href=”<?php bloginfo(‘stylesheet_url’); ?>” media=”screen” />
    <?php else :?>
    <link rel=”stylesheet” type=”text/css” href=”<?php bloginfo(‘template_directory’); ?>/shop.css” media=”screen” />
    <?php endif;?>

    I was hoping someone knew enough php to help me invert it.I can’t seem to find the right syntax for php.

    <?php if( is(NOT)_page(‘shop-2’) ) :?>

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You are close. The “not if” syntax is:

    if (!is_page('shop-2'))

    The ! means “if not true” pretty much.

    Thread Starter cucalon.j

    (@cucalonj)

    Michael,

    Thank you very, but very much. I had tried a few combinations of “is not”, even is!_page. But I did not try the other way around. You just saved me hours and hours of more scrambling to fix such a small problem.

    I appreciate it immensely, sincerely. Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP code question’ is closed to new replies.