Support » Plugins » Hacks » calling featured images from child pages

  • Resolved damian.smith


    Hey guys I have this function below, that calls the information of child pages into the parent page. All works perfectly except the featured images act strangely.

    The featured imahes should sit inside the featured-img div but for some reason they all sit outside of the ul completely, like so:

    <ul class="childrens">
    <li>.... etc etc</li>

    Any ideas?? :/

    function get_children() {
    	global $post;
    	$args = array(
    		'post_parent' => $post->ID,
    		'post_type' => 'page'
    	$subpages = new WP_query($args);
    	// create output
    	if ($subpages->have_posts()) :
    		$output = '<ul class="childrens">';
    		while ($subpages->have_posts()) : $subpages->the_post();
    			$output .= '<li>
    						<div class="featured-img">'.the_post_thumbnail().'</div>
    						<div class="childrens-content">
    						<h3><a href="'.get_permalink().'">'.get_the_title().'</a></h3>
    						<p>'.get_the_excerpt().'<br />
    						<a class="read-more" href="'.get_permalink().'">Read More > ></a></p>
    		$output .= '</ul>';
    	else :
    		$output = '<p>No subpages found.</p>';
    	// reset the query
    	// return something
    	return $output;
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘calling featured images from child pages’ is closed to new replies.