• Luke

    (@lukejongibson)


    I’m trying to use the is_page command, but not having any luck. I’ve made an example below, does anyone see where I’m going wrong?

    <?php if(is_page( array('goody-box', 'double-goody-box') ) ) { ?> <a href="#"><img alt="" src="<?php bloginfo('template_url');?>/images/picture.jpg" width="650" title="" /></a><?php } ?>

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello Luke,

    There may be following possibilities:

    1. You are using this code inside the Loop.
    2. ‘goody-box’, ‘double-goody-box’ are not pages, it may be posts.

    You cannot use is_page within the LOOP, so please check it once and let me know.

    Moderator cubecolour

    (@numeeja)

    If it is used after the loop you will also need to call <?php wp_reset_query; ?> after the loop

    Thread Starter Luke

    (@lukejongibson)

    My code wasn’t inside the loop. I tried using that anyway, but it had no effect.

    <?php
    // THIS GIVES US SOME OPTIONS FOR STYLING THE ADMIN AREA
    function custom_design() {
       echo '<style type="text/css">
               #wphead{background:#592222}
               #footer{background:#592222}
               #footer-upgrade{background:#592222}
               textarea {white-space:nowrap;overflow:scroll;}
             </style>';
    }
    
    add_action('admin_head', 'custom_design');
    ?>

    It seems this piece of code in my functions.php was causing the error. The CSS “whitespace:nowrap” was breaking any new template pages I was making. Totally bizarre. Never seen CSS do that before, at least not to that extent.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘is_page not working’ is closed to new replies.