• Resolved matthisco

    (@matthisco)


    HI Folks,

    Can someone please tell me how I can get this piece of code to work, I just get a blank screen when I browse to it:

    // if pageid is 157 or subpage id of 157

    `<?php if ( is_page( 157 ) || ( is_page() && $post->post_parent) : ?>

    Do something

    <?php endif; ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi matthisco, it looks like you’re using php’s if statement with a :

    When we “clean up your code” or just look at it from a different point of view, we see:

    <?php
    	if (
    		is_page( 157 ) ||
    		(
    			is_page() && $post->post_parent
    		)
    	:
    ?>

    It looks like you’re missing a closing ) on your if statement. If we add that closing ) in there, we get:

    <?php
    	if (
    		is_page( 157 ) ||
    		(
    			is_page() && $post->post_parent
    		)
    	   )
    	:
    ?>

    … or …

    <?php if ( is_page( 157 ) || ( is_page() && $post->post_parent) ):?>

    Keep us updated and let us know if that helps or not!

    Thread Starter matthisco

    (@matthisco)

    Thanks very much that works a treat

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Subpages of page – Urgent syntax help needed please’ is closed to new replies.