Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

shortcode

By: alchymyth on Oct 6th, 2011  |  syntax: None  |  size: 0.84 KB  |  views: 430  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.