Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve usability of the mshot field type #2

Closed
bobbingwide opened this issue Dec 13, 2016 · 3 comments
Closed

Improve usability of the mshot field type #2

bobbingwide opened this issue Dec 13, 2016 · 3 comments
Assignees

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Dec 13, 2016

Current logic

When a field of type mshot is displayed using [bw_fields] then the screenshot is not actually saved in the website, it's just displayed as part of the page. The processing is such that the image the user sees initially is a default gif

https://s0.wp.com/wp-content/plugins/mshots/default.gif

the page has to be refreshed for the actual screenshot to appear.

Proposed logic - first thoughts

The screenshot should be captured when the post is being saved. An attachment should be created for the screenshot and it should be saved as the featured image. The oik custom image link URL field ( see oik-nivo-slider) could be used to store the same value as the mshot field.

When the mshot field is being displayed, the logic should first check to see if it should simply display the featured image.

Proposed logic - second thoughts

Rather than save the information in the featured image, the post ID of the attachment that contains the screenshot should be saved as part of the data for the mshot field type.
It might be a good idea to create a new field type( 'mshot2' ) to allow for transition.

@bobbingwide
Copy link
Owner Author

The mshot2 field will be stored as serialised post meta data.

name type example
url URL - including scheme http://example.com
id post ID of a media file 111

There will be functions following oik-theme's style for displaying fields in forms and the front end.
There will be logic to hook into save_post to determine the value for id.

@bobbingwide
Copy link
Owner Author

There are currently situations where the image that's saved is just the default .gif. We should avoid saving this image since some themes automatically select the first item that's attached to the post for the featured image.

@bobbingwide
Copy link
Owner Author

bobbingwide commented Jan 20, 2017

In bobbingwide.com, the post for the attached image is being created with an incorrect post_type 'portfolio' rather than 'attachment'. This leads to (rather useless) "Missing Attachment" messages from wp_get_attachment_link().

Explanation

Workaround

  • Deactivate post-type-switcher for normal everyday use.

Potential solution

  • Disable post-type-switcher's hook for wp_insert_attachment_data in oikms_create_attachment before calling media_add_sideload().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant