• Yo mo fo’s,

    I’ve flummoxed myself with an if statement. Here is my code:

    if (is_page(64)){
    	$recent = new WP_Query("page_id=64");	//Define the post
    	while($recent->have_posts()) : $recent->the_post();	//Start the loop
    		the_content();	//Get the content
    		endwhile;}	//End loop

    When I run the statement I get the 404 page. It pulls in the post out of the if statement.

    I am using wp_nav_menu() to call in the navigation. Should this matter?

    EDIT: it did work at one point but I’m struggling to fathom what I did wrong. I am also using the wp_reset_query in the footer.

    EDIT 2: the url reads /contact but is pulling in the 404 page.
    N.B. 64 is id of my contact page (not post).

    Thanx for looking,
    Sam

The topic ‘Strange if statement’ is closed to new replies.