Display list of uploaded images, filtered by user under a specific user group

This example loops through all photographers and then displays all images uploaded by them: <ul> <?php $photographers = get_users( ‘role=photographer’ ); foreach( $photographers as $user ) : $pictures = new WP_Query( array( ‘author’ => $user->ID, ‘post_type’ => ‘attachment’, ‘post_status’ => ‘inheret’, ‘posts_per_page’ => -1 ) ); echo ‘<li><h3>’ . $user->user_nicename . ‘</h3>’; if ( $pictures->posts … Read more

Issue where WP Featured Image will not display

Let’s examine the differences between the working and the not-working code: Working: has_post_thumbnail( $post->ID ) Not Working: get_the_post_thumbnail(); The only difference I see is that you’re passing the $postID explicitly to the working function, and not passing it to the non-working function. So, try this: get_the_post_thumbnail( $post->ID, ‘medium’ ); You can var_dump() or echo it … Read more

Modifying the HTML Output of Inserted Images

This filter checks if an anchor is in the html image send to the editor and if so adds rel and class to the anchor. function add_highslide_attr( $html ) { preg_match_all(‘/(<a[^>]*>)(.*)/i’, $html, $result); if( !isset($result) || !isset($result[1][0]) || ! $result[1][0] ) return $html; $anchor = $result[1][0]; if( strstr($anchor, ‘rel=”) ) $anchor = str_replace(“rel=””https://wordpress.stackexchange.com/questions/77460/,”rel=”highslide ‘, $anchor); … Read more