Title: Trouble pulling custom post values in loop
Last modified: August 21, 2016

---

# Trouble pulling custom post values in loop

 *  Resolved [rtourtelot](https://wordpress.org/support/users/rtourtelot/)
 * (@rtourtelot)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/trouble-pulling-custom-post-values-in-loop/)
 * Hi,
 * I have a custom post type ‘events’, which includes **date** and **description**
   fields. I’ve listed them successfully on a page with their permalinks, which 
   results in a link ending in:
 * /events/ingenuity-2014-kick-off-reception/?title=Ingenuity%202014%20Kick-Off%
   20Reception
 * So I’m passing the **title** in the URL, and then have this code in single.php:
 *     ```
       <?php $title = $_GET['title']?>
   
       			<!-- !- Content -->
       			<div id="content" class="content" role="main">
   
       				<?php
       				$args = array(
       				'posts_per_page' => -1,
       				'post_type' => 'events',
       				'order' => 'asc'
       				);
       				$eventslist = new WP_Query( $args );
       				while ($eventslist->have_posts()) : $eventslist->the_post(); 
   
       				$actual_title = the_title();
   
       				if($title==$actual_title) {
   
       				$description = get_field('description');
       				$date = get_field('date');
   
       				 ?>
   
       				 The description:
       				 <?php echo $description ?>
       				 <?php echo $date ?>
       				</div>
   
       				<?php } ?>
       ```
   
 * For some reason, the resultant single.php page is simply spitting out the titles
   for every post in the events class. I can’t even see where it would show the 
   title, and am having no luck echoing the description based on that specific title.
 * Is it the %20 that is messing me up? I thought GET would deal with those. Is 
   it something else I’m missing? I’m really stumped… thanks for any help!

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

 *  Thread Starter [rtourtelot](https://wordpress.org/support/users/rtourtelot/)
 * (@rtourtelot)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/trouble-pulling-custom-post-values-in-loop/#post-5150561)
 * Is this in the wrong forum section, maybe? I couldn’t seem to post it in Advanced.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [11 years, 10 months ago](https://wordpress.org/support/topic/trouble-pulling-custom-post-values-in-loop/#post-5150636)
 * It’s not the wrong section. Maybe you’re used to a premium level of support? 
   That expectation can’t be carried into WordPress.org support, all support here
   is given out of people’s free time. That means your thread can go unanswered,
   or unresolved. These forums can’t do any deadlines either.
 * _[http://codex.wordpress.org/Forum\_Welcome#No\_Bumping](http://codex.wordpress.org/Forum_Welcome#No_Bumping)_
 *  Thread Starter [rtourtelot](https://wordpress.org/support/users/rtourtelot/)
 * (@rtourtelot)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/trouble-pulling-custom-post-values-in-loop/#post-5150638)
 * Thanks.
 *  Thread Starter [rtourtelot](https://wordpress.org/support/users/rtourtelot/)
 * (@rtourtelot)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/trouble-pulling-custom-post-values-in-loop/#post-5150643)
 * Here’s the answer for anyone else who’s wondering: in the above, `the_title()`
   needs to be replaced with `get_the_title()`. That’s it. Works great now.

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

The topic ‘Trouble pulling custom post values in loop’ is closed to new replies.

## Tags

 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [rtourtelot](https://wordpress.org/support/users/rtourtelot/)
 * Last activity: [11 years, 10 months ago](https://wordpress.org/support/topic/trouble-pulling-custom-post-values-in-loop/#post-5150643)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
