Query the post which have a thumbnail
try to work this into your query: ‘meta_key’ => ‘_thumbnail_id’ http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
try to work this into your query: ‘meta_key’ => ‘_thumbnail_id’ http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
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
Actually there isn’t the_post_thumbnail filter applied anywhere. The one you could try to use and to modify content that goes to the_post_thumbnail function is the post_thumbnail_html filter what is called with the following arguments $html, $post_id, $post_thumbnail_id, $size, $attr.
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)
Add a semicolon ; after get_the_post_thumbnail( $id ): get_the_post_thumbnail( $id );
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
I realize this is almost 2 years too late, but I hope it’s still useful to some people that land here looking for an answer. Disclaimer: this is not a great pattern according to WordPress admin design patterns, but it’s actually nice to use in a pinch. Insert the following into your functions.php file in … Read more
@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
I’ve used Post Thumbnail Editor on many sites, its really very good. Just remember when it opens, that it opened in a new tab, once you’re done cropping, close the tab to get back to where yo were http://wordpress.org/plugins/post-thumbnail-editor/
I haven’t tested your code, but I recently spent a few hours hacking something together to solve the same issue — making background images set via the WordPress customizer load responsively. Feel free to use / modify the code below to your needs, and send any questions my way. I’m not a PHP expert by … Read more