WordPress.org

Support

Support » How-To and Troubleshooting » is_page() producing odd results

is_page() producing odd results

  • Here is my code, it is in the footer.php of my theme.

    I expect that the code inside will only be executed IF it is page 7 (which is my Home page). Weirdly enough, it is showing on ALL pages.

    <?php if(is_page(7)):?>
    		<script type="text/javascript">
    		<!--
    		swfobject.registerObject("FlashID");
    		//-->
    		</script>
    <?php endif;?>

    If i set it to !is_page() it works, like this:

    <?php if(is_page(7)):?>

    Any ideas why this would be acting up?

    (i have spent 14 consecutive hours on this project 🙂

Viewing 1 replies (of 1 total)
  • seemed to have fixed it using

    <?php if(is_front_page()):?>

    when the front page is changed to a post or page, this serems to be the way top go.

    you live, you learn…

Viewing 1 replies (of 1 total)
  • The topic ‘is_page() producing odd results’ is closed to new replies.
Skip to toolbar