[Resolved] Automatically Set Featured Image on Create New Page

I’m working on a client site and would like for some things to be a bit more automated for them if possible. Right now, if you’ve just created a new gallery, you have the option of Create New Page in the gallery settings where pressing the Add Page button will create a new page with a shortcode to that gallery. Then it’s up to the user to go to that new page and select an image to be the featured image.

The code that makes this happen in Nextgen appears to be in \admin\manage.php:

Could anyone give me some insights on how to have this function automatically use the selected “Preview Image” from the particular gallery settings page become the default featured image of the newly created page?

What this code does is to grab the file location of the selected preview image from the particular NextGen gallery you’re on, copies that image into the media library, creates a media library database entry for the file, and finally updates the featured image on the new page with the ID of that image.

Unfortunately, it still doesn’t work for me. I am using WP3.5 and nextgen V1.9.10; but there is something I should mention. My theme didn’t support Feature Image before. I added the code to the function.php, index.php and single.php to support featured image.

Hmm. . so one question to see whether the code is functioning at all would be to see if the preview image is appearing in the media gallery after you click the Add Page from the NextGen gallery you’re in. Also, see if you can check the uploads folder to see if any new images have been copied there. If nothing is going on, then there’s something wrong with the code itself or the placement of the code.

I confirm that nothing is going on. My gallery has a different gallery directory, does that affect the outcome?

I created a test post using an existing gallery, no featured image was grabbed, no new image was copied to media library. I placed the code right after `do_action(‘ngg_gallery_addnewpage’, $this->gid);
}`

Ok, my bad. I completely missed the ‘page’ in this thread. I was looking for automatically using the first image of nextgen gallery as featured image of a ‘post’, and I actually want it to work retrospectively (because many old posts do not have featured image now).

I am so sorry to have wasted your time, and thank you so much for taking the time.