Title: pod loop not pulling custom post type
Last modified: July 2, 2019

---

# pod loop not pulling custom post type

 *  Resolved [dhdesign1356](https://wordpress.org/support/users/dhdesign1356/)
 * (@dhdesign1356)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/pod-loop-not-pulling-custom-post-type/)
 * I started using pods for the first time, and while I was excited, I’m having 
   a hard time getting the loop to work. The idea is to display a custom post type
   created called Home Section with which I’ve created custom fields. As of right
   now, the variable isn’t showing as existing but this is the closest I’ve come
   to having anything function using the pod loop.
 *  <?php
 *  $mypod = pods(‘home_section’);
 *  if( $mypod->exists() ){
 *  $title = $mypod->display(‘title’);
    echo $title;
 *  }
 *  else {
 *  echo ‘This is alll wrong!’;
    }
 *  ?>
 * The good news is, I’m at least getting the else on my if/else loop. I’ve tried
   many different strategies to call home_section and nothing has worked. Any suggestions
   would be helpful. I’ve tried calling an array and running ->find() on the array,
   I’ve tried fetch(), I’ve tried $mypod = pods(‘home_section’, get_the_ID()), but
   nothing is working unless I run a wp_query loop setting my custom post type in
   an array. That works great but I don’t access to the full functionality that 
   pods has to offer. I appreciate any and all help.

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

 *  Thread Starter [dhdesign1356](https://wordpress.org/support/users/dhdesign1356/)
 * (@dhdesign1356)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/pod-loop-not-pulling-custom-post-type/#post-11696871)
 * Looks like the issue wasn’t with my array, but with my using the get_template_part(‘
   content’, ‘section’); within my loop. I removed it after switching up my loop
   to include an array, find(), and while(); Now, everything is working.
 *  <!–/* Start the Loop */–>
    <?php
 *  $mypod = pods(‘home_section’);
    $params = array( ‘limit’ => -1 );
 *  $mypod->find($params);
 *  while ($mypod->fetch()) :
    ?>
 *  <?php
 *  $pic = $mypod->field(‘section_background_image’);
    $pic = pods_image_url($pic,
   $size = ‘full’, $default = 0, $force = false); $title = $mypod->display(‘title’);
 * ?>
    <style>
 *  section.section-bkgd {
 *  background: url(“<?php echo $pic; ?>”) fixed;
    -webkit-box-shadow: inset 0 0
   50px rgba(0,0,0,.5); -moz-box-shadow: inset 0 0 50px rgba(0,0,0,.5); box-shadow:
   inset 0 0 50px rgba(0,0,0,.5); height: 500px; }
 * </style>
 * <section class=”sol-homecontent-style section-bkgd”>
    <div class=”sol-home-section”
   >
 *  <h1><?php echo esc_html($title); ?></h1>
 *  </div><!– .entry-content –>
    </section>
 * <?php
 * endwhile;
    ?>
 *  Plugin Contributor [Jim True](https://wordpress.org/support/users/jimtrue/)
 * (@jimtrue)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/pod-loop-not-pulling-custom-post-type/#post-11698103)
 * Glad you figured it out.

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

The topic ‘pod loop not pulling custom post type’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Jim True](https://wordpress.org/support/users/jimtrue/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/pod-loop-not-pulling-custom-post-type/#post-11698103)
 * Status: resolved