• 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.

    https://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

    (@jcastaneda)

    THEME COFFEE MONKEY

    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

    (@ccradmin)

    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

    (@ccradmin)

    From what I found it the p tag causing the text to go outside the parent element and theres no styling on it either

    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

    (@ccradmin)

    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.