# Receiving T_String parse error when adding custom post type to loop

**URL:** https://discourse.roots.io/t/receiving-t-string-parse-error-when-adding-custom-post-type-to-loop/204
**Category:** uncategorized
**Created:** 2013-08-27T16:23:39Z
**Posts:** 4

## Post 1 by @theatereleven — 2013-08-27T16:23:40Z

I’ve registered a custom post type, and that works without issue. My code to register is:

```
add_action( 'init', 'hvac_products' );

function hvac_products() {

register_post_type( 'hvac-products',
	array(
	  'labels' => array(
		'name' => 'HVAC Products',
		'singular_name' => 'HVAC Product',
	   ),
	  'description' => 'Add products to your main products page.',
	  'public' => true,
	  'menu_position' => 20,
	  'supports' => array( 'title', 'editor',)
));
}
```

Now that I’ve added a post, I’m trying to loop it into a custom template, and it is throwing a parse error. The code I’m using in my custom template is this:

```
<?

 $loop = new WP_Query( array( 'post_type' => 'hvac-products', 'posts_per_page' => 10 ) );
 while ( $loop->have_posts() ) : $loop->the_post();

	 echo '<div class="products-container">';
		 echo '<div class="products-image">';
		 echo '<img src="';
		 the_field('product_image');
		 echo '" alt="<?php the_title();" ?></a></div>';
		 echo '<div class="products-text">';
			 echo '<h2 class="product-title">';
			 the_title();
			 echo '</h2>';
			 the_field('product_description');

			 echo '</div>';

		 echo '</div>';

	 echo '</div>';

	  echo '<div class="clear"></div>';

   endwhile;

?>
```

I’ve attached a screen shot of the parse error. This is a fresh WP 3.6 install with the latest Roots. The only plugins I have active are ACF and Contact Form 7.

![](https://discourse.roots.io/uploads/default/9/584b54ae57cb52fd.png)

Any help greatly appreciated!

---

## Post 2 by @theatereleven — 2013-08-27T16:29:20Z

Dang - sorry everyone. After posting I finally figured it out, but it still doesn’t make sense to me.

I open with `<?` but it wanted `<?php`.

However, I have another Wordpress 3.6 site posting CPTs and beginning the loop with `<?` and they are working fine. So I’m at a loss as to what the difference is.

---

## Post 3 by @chriscarr — 2013-08-27T17:19:25Z

This will be host and hosting account specific, whether short php tags is activated. It’s a good idea to just use the full tag all the time to be compatible with all hosts.

---

## Post 4 by @theatereleven — 2013-08-28T15:58:56Z

Oh gotcha, that makes sense. Great to know - thanks Chris.
