Tagged: media, mediapress
Hi Karamveer,
Thank you.
the gallery is a post type as you might have guessed already.
Can you please check if the gallery exists on the site in context? Also, the media from a specific site ca be added to gallery on that site(gallery is set as parent post of the media internally in MediaPress).Please let me know if these conditions have met? If yes, please share your complete code using pastebin to allow me try the same.
Regards
BrajeshHi Brajesh,
https://github.com/buddydev/mediapress/blob/1.5-dev/core/ajax/mpp-ajax.php#L312
I tried it and found above variable in $media_data looking to have POST File type data with => enctype=”multipart/form-data” headers.
We can’t pass the values in that way as media already there on the server.
I thought passing all static values(for testing) in $media_data may get some lead. We tried to assign all valid values to $media_data but not succeed.
Please help us to fix this issue we just 1 step behind to conclude the requirement that is attach the media with gallery.
Regards,
Karamveer SinghHi Karamveer,
Since you are able to successfully create an attachment, why not import it to gallery usingmpp_import_attachment( $attachment_id, $gallery_id, $override = array() );
This function calls import attachment internally whose implementation you can see here.
https://github.com/buddydev/mediapress/blob/1.5-dev/core/media/class-mpp-media-importer.php#L44This should be straight forward solution for you.
Regards
BrajeshHere is even easier suggestion.
1. Use WordPress api to add file as an attachment
2. Use the attachment id and import it to your gallery using the above solutionYou do not need to worry about upload locations etc as the plugin will take care of that.
Regards
BrajeshHi Brajesh,
Thanks, I think the same API concept already using in our custom script no separate function is being used in the program.
Furthermore will try it with the POSTMAN tool to check attachment is working or not and will get back to you.
Would you please send me the media press endpoints to attach the media with Gallery?
Regards,
Karamveer SinghHi Karamveer,
I am sorry, I could not find time to work on it. I will post an example code this weekend.Regards
Brajesh
You must be logged in to reply to this topic.