Advertisement
alchymyth

shortcode

Oct 6th, 2011
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. /*-----------------------------------------------------------------------------------*/
  2. /* Photos
  3. /*-----------------------------------------------------------------------------------*/
  4.  
  5. if ( function_exists( 'add_image_size' ) ) {
  6. add_image_size('second_thumb_event', 150, 100, true );
  7. }
  8.  
  9. function photos() {
  10. $images = get_children(array('post_parent' => get_the_ID(),'post_type' => 'attachment','numberposts' => $qty,'post_mime_type' => 'image',));
  11.  
  12. $output = '';
  13. foreach( $images as $image ) :
  14. $attachmenturl=wp_get_attachment_url($image->ID);
  15. $attachmentimage=wp_get_attachment_image( $image->ID, 'second_thumb_event' );
  16. if ($src[0]!=$attachmenturl):
  17. $output .= '<a rel="prettyPhoto[gallery]" href="'.$attachmenturl.'" >'.$attachmentimage.'</a>' ;
  18. endif;
  19. endforeach;
  20. return $output;
  21. }
  22.  
  23. add_shortcode( 'photo_gallery', 'photos' );
  24.  
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement