Display child pages on a parent and child page using Featured Thumbnails

Use get_ancestors to get the page parent, then get the children of that parent. $ancestors = array(); $ancestors = get_ancestors($post->ID,’page’); $parent = (!empty($ancestors)) ? array_pop($ancestors) : $post->ID; if (!empty($parent)) { $kids = new WP_Query( array( ‘post_parent’=>$parent, ‘post_type’ => ‘page’, ‘ignore_sticky_posts’ => true ) ); if ($kids->have_posts()) { while ($kids->have_posts()) { $kids->the_post(); echo ‘<a href=”‘.get_permalink().'” title=”‘.get_the_title().'”>’.get_the_post_thumbnail().'</a>’; … Read more

VT-resize image and display it [duplicate]

Whoa, ok let’s take a step back and use an actual WordPress function, that way your not doing anything weird like the above. Use these: http://codex.wordpress.org/Function_Reference/wp_get_attachment_image (the images) http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src (array with atributes) http://codex.wordpress.org/Function_Reference/the_post_thumbnail (featured image)

get_pages – Display child then grandchild pages

You don’t need 2 queries, just use a bit of logic and 2 foreach loops: $portfolioID = $post->ID; $portfolio_sections = array( ‘post_type’ => ‘page’, ‘child_of’ => $portfolioID, ‘sort_column’ => ‘menu_order’, ‘sort_order’ => ‘ASC’, ); $sections = get_pages($portfolio_sections); $hierachical = array(); if ( ! empty($sections) ) { foreach ( $sections as $section ) { if ( … Read more

Add post title as alt tag for featured image

@its_me got it almost right. Those args must be 2nd resp. 3rd Parameter, not first: $attr = array( ‘title’ => ‘howdy partner’, ‘alt’ => ‘a nice view of the ocean’, ); // pick one, note 2 or 3 arguments: the_post_thumbnail( ‘post-thumbnail’, $attr ); echo(“<a href=”https://wordpress.stackexchange.com/questions/57968/$p->permalink”>”. // null for current $post->ID (use within loop) get_the_post_thumbnail( null, … Read more