Reputation: 3
I have made a custom theme, and some custom page templates. Two of the templates have the same loop. They both list the sub-pages of the parent page. Somehow after 5 sub-pages the loop decides to make a mess and puts the last two sub-pages inside each other.
It breaks the footer and inserts code where it shouldn't. The result of this can be seen @ http://spkow.com/sites/megatec/?page_id=16
I know I ain't the best coder as of yet. What is going on?
<div id="parent_top_content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(__('Read more'));?>
<?php endwhile; else: ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
</div>
<div id="parent_content_wrapper">
<?php
$pageChildren = get_pages('sort_column=menu_order&hierarchical=0&child_of='.$post->ID);
if ( $pageChildren ) {
foreach ( $pageChildren as $pageChild ) {
echo '<a class="parent_list_link" href="'. get_permalink($pageChild->ID) .'"><div class="parent_list_element"><div class="parent_list_thumb">' . get_the_post_thumbnail($pageChild->ID, 'thumbnail') . '</div><div class="parent_list_inner"><h3 class="parent_list_title">' . $pageChild->post_title.'</h3>';
if (!empty($pageChild->post_excerpt)){
echo '<p class="parent_list_excerpt">' . $pageChild->post_excerpt.'</p></div><span id="clear"> </span></div></a>';
}
}
}
?>
<?php wp_reset_query(); ?>
</div>
Upvotes: 0
Views: 62
Reputation: 7611
You're opening your link for all child pages, but you're only closing it if the child has an excerpt, resulting in invalid html. See the w3c validator.
Try fixing that (and the other html errors) and see if that helps.
Upvotes: 1