Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php // cretae gallery automatically
- $images = get_children( array ( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image' ));
- if ( !empty($images) ) {
- $i = 0; foreach ( $images as $attachment_id => $attachment ) {
- if ($i == 0) { $i++; continue;}
- $attachment_meta = wp_get_attachment($attachment_id); $alt_title = str_replace('-', ' ', $attachment_meta['title']);
- //post's tags
- $tags = wp_get_post_tags($post->ID);
- $tagsString = ' ';
- foreach($tags as $tag){
- $tagsString = $tagsString.' '.$tag->name;
- }
- $arr_img = array( 'alt' => ucwords($alt_title).$tagsString, 'title' => ucwords($alt_title), ); echo '<span class="adagambar">' ; echo '<a href="' .get_attachment_link($attachment_id). '" rel="bookmark">' ; echo wp_get_attachment_image( $attachment_id, 'large', '', $arr_img ) ; echo '</a></span> '; echo '<center><strong>'. $alt_title .'</strong></center>';
- if ($i == 0) { break; } else {$i++;}
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement