Title: Code is breaking my template
Last modified: August 20, 2016

---

# Code is breaking my template

 *  [ccradmin](https://wordpress.org/support/users/ccradmin/)
 * (@ccradmin)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/code-is-breaking-my-template/)
 * I am creating a template and when i use this code
 *     ```
       <?php $subs = new WP_Query( array( 'post_parent' => $post->ID, 'post_type' => 'page', 'meta_key' => '_thumbnail_id' ));
       					if( $subs->have_posts() ) : while( $subs->have_posts() ) : $subs->the_post();
       						?>
       						<div class="product">
       							<? echo get_the_post_thumbnail($post->ID, 'medium'); ?>
       							<?php the_content(); ?>
       						</div>
       						<?
       					endwhile; endif; wp_reset_postdata(); ?>
       ```
   
 * It breaks my template, “the_content()” text goes right out of the wrapper element.
   If I replace the code above with static text the same as whats in “the_content()”
   for my pages it doesn’t break the template.
 * Whats going on here is another thread post on a another forum i made for the 
   same issue, use it as a reference if needed to help me fix this problem.
 * [http://forums.phpfreaks.com/topic/271328-p-tag-through-parent-element/](http://forums.phpfreaks.com/topic/271328-p-tag-through-parent-element/)
 * Thanks, in Advance

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

 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [13 years, 6 months ago](https://wordpress.org/support/topic/code-is-breaking-my-template/#post-3231075)
 * It sounds like you are having a CSS issue. It could also be that you aren’t using
   the proper PHP opening tags.
 *  Thread Starter [ccradmin](https://wordpress.org/support/users/ccradmin/)
 * (@ccradmin)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/code-is-breaking-my-template/#post-3231079)
 * its not a css problem because i have no styling on the elements atm,
 * Beside on the main page of the site the styling works fine
 *  Thread Starter [ccradmin](https://wordpress.org/support/users/ccradmin/)
 * (@ccradmin)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/code-is-breaking-my-template/#post-3231080)
 * From what I found it the p tag causing the text to go outside the parent element
   and theres no styling on it either
 *  [ronangelo](https://wordpress.org/support/users/ronangelo/)
 * (@ronangelo)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/code-is-breaking-my-template/#post-3231081)
 * Did you check the post that you used as an example? it’s curious why it should
   have an `&nbsp;` between the blahs
 * It possible that the lack of styling itself is what’s causing it.
    default styling
   could be different for static content and generated content.
 * perhaps adding styling like
    `overflow: hidden;` for the wrapper or a `word-wrap:
   break-word;` for the `<p>`
 * Are you creating a theme from scratch or is it a child-theme?
 *  Thread Starter [ccradmin](https://wordpress.org/support/users/ccradmin/)
 * (@ccradmin)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/code-is-breaking-my-template/#post-3231095)
 * putting the word-wrap: break-word; on the <p> tag worked! thanks a lot!

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

The topic ‘Code is breaking my template’ is closed to new replies.

 * 5 replies
 * 3 participants
 * Last reply from: [ccradmin](https://wordpress.org/support/users/ccradmin/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/code-is-breaking-my-template/#post-3231095)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
