voceconnect / multi-post-thumbnails

Adds multiple post thumbnails to a post type. If you've ever wanted more than one Featured Image on a post, this plugin is for you.
143 stars 63 forks source link

Exporting thumbnail images with custom post types #52

Closed deardooley closed 9 years ago

deardooley commented 9 years ago

Thanks for the great work on this plugin. I have an issue/feature request. I need to export several custom post types which use this plugin. The problem I run into is that the images do not export with the post types. The custom metadata exports fine, but the images do not. I realize this is technically due to the way the native wordpress exporter works, but I believe the problem actually boils down to the manner in which the plugin associates images with post types. I can think of two possible solutions off the top of my head.

  1. Provide a custom exporter plugin to work around this situation when users export partial content from their blogs.
  2. Force an association between every thumbnail with its parent post type. In situations where the image is already associated with a post type, duplicate it and associate the copy with the post type.

I've prototyped them both, and they work, but neither feels like a good general solution. I'd like to hear your thoughts.

chrisscott commented 9 years ago

As you noted, this is a limitation of the exporter since any partial export doesn't check (natively or through allowance by a filter) for any attached or associated (through metadata) attachments and add them to the WXR. Solution 1 definitely seems like the clean option to me.

deardooley commented 9 years ago

If I work that into the existing plugin via a settings panel, would you accept the pull request, or would you rather it be an external thing to handle file attachments in a more general way?

Rion

On Jan 15, 2015, at 3:20 PM, Chris Scott notifications@github.com wrote:

As you noted, this is a limitation of the exporter since any partial export doesn't check (natively or through allowance by a filter) for any attached or associated (through metadata) attachments and add them to the WXR. Solution 1 definitely seems like the clean option to me.

— Reply to this email directly or view it on GitHub https://github.com/voceconnect/multi-post-thumbnails/issues/52#issuecomment-70163925.

chrisscott commented 9 years ago

I think a separate plugin would make sense since this has a broader use case outside this plugin and would probably be more valuable as a standalone.

thedavedavies commented 9 years ago

@deardooley did you manage to come up with a solution for this at all? I'm in the same boat at the moment, and could definitely do with an export solution...

deardooley commented 9 years ago

@dav086 Yes. I wound up forking demomentsomtres-wp-export and adding in support for the things I needed. There are some schema issues in wordpress that prevent this from being done cleanly as in other posts. Message me offline if you'd like a copy.

thedavedavies commented 9 years ago

@deardooley I'd love a copy please! Although I can't work out how to message you on Github other than through this board, sorry. My email address is on my profile for the time being. Thanks a lot :+1:

deardooley commented 9 years ago

On it's way. For posterity, those of you reading this thread in the future should checked out the Wordpress REST API. There's a great tutorial and slide deck by @petenelson about Extending the Wordpress API and bending it to your will from his talk at the Austin Wordpress Meetup.