Title: custom loop
Last modified: August 20, 2016

---

# custom loop

 *  [ricarjay](https://wordpress.org/support/users/ricarjay/)
 * (@ricarjay)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/custom-loop-4/)
 * Hi Admin,
 * I’m creating a custom page with a custom query and here the code i found on the
   codex.wordpress.org “$page = new WP_Query( ‘pagename=home’);” my problem i can’t
   pull the content of the page i don’t know how please help me.
 * Thanks

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/custom-loop-4/#post-3059251)
 * Perhaps you need to review [http://codex.wordpress.org/Function_Reference/WP_Query](http://codex.wordpress.org/Function_Reference/WP_Query)
 *  Thread Starter [ricarjay](https://wordpress.org/support/users/ricarjay/)
 * (@ricarjay)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/custom-loop-4/#post-3059259)
 * Hi Esmi,
 * Thank for you reply I already did check the link, i did also tried copy some 
   of the code and here what i got
 *     ```
       <?php $page = new WP_Query( 'pagename=home'); while( $page->have_posts() ) : $page->the_post(); ?>
           <div class="container2 clearfix">
             <?php  the_content();  ?>
           </div><!--container2--><?php endwhile; ?>
       ```
   
 * it did show the content that i need, but sadly i also got this error message
   “
   Fatal error: Call to a member function have_posts() on a non-object in C:\xampp\
   htdocs\webfast\wp-content\themes\webfast\chome.php on line 28”
 * what do you think i did wrong ? thanks for your help
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/custom-loop-4/#post-3059324)
 * Have you checked that your Home page actually has the slug “home”?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘custom loop’ is closed to new replies.

 * 3 replies
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/custom-loop-4/#post-3059324)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
