Title: Calling One Post Without a Loop?
Last modified: August 20, 2016

---

# Calling One Post Without a Loop?

 *  [hotwebideas](https://wordpress.org/support/users/hotwebideas/)
 * (@hotwebideas)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/calling-one-post-without-a-loop/)
 * I have a question which I am sure has been asked several times, but I cannot 
   find this on Google.
 * I have a loop using WP_Query, but I know I can also use get_posts. My code below
   uses $posts->have_posts() for the loop, but I don’t think I should have to use
   a loop to get just one post.
 * How can I add the below code without the $posts->have_posts() loop in my theme?
   is there an array I can use instead like $posts[0]?
 *     ```
       $posts = new WP_Query(array(
          'post_type' => 'home_page_highlights',
          'posts_per_page' => 1,
          'meta_key' => 'sort',
          'meta_value' => $sort,
   
       )); 
   
       while ( $posts->have_posts() ) : $posts->the_post();
   
           echo "<h1>" . get_the_title() . "</h1>";
           echo "<p>" . the_content() . "</p>";
       endwhile;
       ```
   
 * _[please mark any posted code – [http://codex.wordpress.org/Forum\_Welcome#Posting\_Code](http://codex.wordpress.org/Forum_Welcome#Posting_Code)]_
 * _[[please do not bump]](http://codex.wordpress.org/Forum_Welcome#No_Bumping)_

The topic ‘Calling One Post Without a Loop?’ is closed to new replies.

## Tags

 * [get_posts](https://wordpress.org/support/topic-tag/get_posts/)
 * [loops](https://wordpress.org/support/topic-tag/loops/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * 0 replies
 * 1 participant
 * Last reply from: [hotwebideas](https://wordpress.org/support/users/hotwebideas/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/calling-one-post-without-a-loop/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
