Title: Strange if statement
Last modified: August 21, 2016

---

# Strange if statement

 *  [samcrawshaw](https://wordpress.org/support/users/samcrawshaw/)
 * (@samcrawshaw)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/strange-if-statement/)
 * 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()](http://codex.wordpress.org/Function_Reference/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](http://codex.wordpress.org/Function_Reference/wp_reset_query)
   in the footer.
 * EDIT 2: the url reads [/contact](https://wordpress.org/support/topic/strange-if-statement/?output_format=md#nowhereinparticular)
   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.

## Tags

 * [if statement](https://wordpress.org/support/topic-tag/if-statement/)

 * 0 replies
 * 1 participant
 * Last reply from: [samcrawshaw](https://wordpress.org/support/users/samcrawshaw/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/strange-if-statement/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
