Viewing 4 replies - 1 through 4 (of 4 total)
  • I’m in the same boat as everyone that is having trouble getting this to work with 3.5. I’m using WP-Property plugin (which uses the standard WP media gallery) and was only getting the last post to display an image assigned to multiple posts.

    I see the author added the code from Sebmeric, but it wasn’t working without manually referencing and even then the format wasn’t useful. I’ve gone through and updated so the format matches that from the media gallery.

    $gallery  = ($post->gallery)?$post->gallery:$property['gallery'];
    	  //get the attachements via Sebmeric's addition
    	  $fun = fun_get_attachments( array( 'post_mime_type' => 'image/jpeg' ) );
    	  foreach( $fun as $f){
    		$i['post_title'] = $f->post_title;
    		$i['post_excerpt'] = $f->post_excerpt;
    		$i['post_content'] = $f->post_content;
    		$i['attachment_id'] = $f->ID;
    
    		//get the image links for all the sizes
    		foreach (get_intermediate_image_sizes() as $s) {
    			$img = wp_get_attachment_image_src( $f->ID, $s );
    			$i[$s] = $img[0];
    		}
    
    		$m[$f->post_title] = $i;
    	  }
    	  $gallery = ($m)?$m:$gallery;

    Obviously I’d like to avoid a foreach within a foreach, but it works. Hopes this helps ??

    Hello jamin, I don’t have a lot of experience with php but I’d like to use your code. Can you tell me how I should insert it into my site? Should I add it to Sebmeric’s plugin or to file-un-attach? If it’s the latter- to which php function should I add it to? Finally, how can I call the appropriate function from a page? Thanks!

    Plugin Author Hax

    (@hax)

    @kasiao,

    If you are using the [gallery] shortcode it will work by default, be sure that you don’t set the id option [gallery id=""]

    Hello, I’m actually using a theme ( portfolio2 ) that doesn’t use the gallery shortcode but rather calls a page’s attachments directly.

    Can you explain how/where I should insert it jamin’s code into my site? Should I add it to Sebmeric’s plugin or to file-un-attach (as it stands Seberic’s helper plugin crashes my site)?

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how to make multiple attachments to work’ is closed to new replies.