Support » Plugin: Frontend Uploader » [ patch ] Uploaded Image as featured, and CT posts

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thanks to Rinat for this Plugin!
    And thx also to you, Guy! Moving “do_action( ‘fu_after_create_post’, $post_id )” into _handle_result worked for me, too (from line 325 to 424 in v 0.5.9.2)

    This code in functions.php just makes the first uploaded image the post thumbnail:

    add_action( 'fu_after_create_post', 'fu_attach_thumbnail' );
    function fu_attach_thumbnail( $post_id ) {
    	$args = array(
    	'post_type' => 'attachment',
    	'post_mime_type' => 'image',
    	'post_parent' => $post_id
    	);
    	$images = get_posts( $args );
    	if($images) {
    		$image=array_shift($images);
    		set_post_thumbnail( $post_id, $image->ID );
    	}
    	foreach($images as $image):
    	 // do something with the other attached images...
    	endforeach;
    }

    The other uploaded images could become a gallery or so…?

    Plugin Author Rinat Khaziev

    (@rinatkhaziev)

    Hey,

    Thanks for the patch. I’m swamped at my job right now, so can’t promise when I’ll be able to incorporate it into the next release.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[ patch ] Uploaded Image as featured, and CT posts’ is closed to new replies.