Metas for Attachment Post Type
- This topic has 10 replies, 2 voices, and was last updated 8 years, 2 months ago by
sociality.
-
AuthorPosts
-
February 7, 2017 at 9:57 PM #4996
sociality
ParticipantHello there!
I have added some fields in attachment post type. I can see them in "Edit more details" option in the "Attachment Details". Still, I want to put those fields in "Attachment Details" pop up in order to be easier for the user to edit them and being autosaved that have to take one more step to do that. Is this possible via your plugin?
Thank you and congrats for the nice plugin 🙂
February 10, 2017 at 10:48 AM #5037Anh Tran
KeymasterI'm afraid not. The "Attactment Details" popup is created and triggered by JavaScript, while most of our work is PHP.
February 13, 2017 at 3:48 AM #5065sociality
ParticipantToo sad.
Well, I believe that it should be much more easier for the user to fulfill the metas through the pop up window and not through the page of the attachment (one step more). Does any other of your plugins do that or maybe you could somehow guide me and achieve this?
Thank you anyway 🙂
February 13, 2017 at 1:33 PM #5071Anh Tran
KeymasterI've seen Jetpack plugin do that. Not sure if there's any solution in general for that.
February 13, 2017 at 11:06 PM #5074sociality
ParticipantI found this article https://code.tutsplus.com/articles/how-to-add-custom-fields-to-attachments--wp-31100
describing what we are talking about. Take a look at show_in_modal parameter. It is exactly what I want. Maybe you could integrate that into your plugin.
Cheers.
February 14, 2017 at 4:56 PM #5091Anh Tran
KeymasterGreat link! Thanks for letting me know. I will check that.
February 14, 2017 at 5:06 PM #5093sociality
Participant😉 Well if you make any updates, let me know! Thank you for the support.
Cheers.
February 17, 2017 at 1:41 PM #5128Anh Tran
KeymasterHi again,
I was able to do this! You need to download the development version on Github to have this feature: https://github.com/rilwis/meta-box
To enable a meta box for media modal, you need to set:
'post_types' => 'attachment', 'media_modal' => true,
to the meta box parameters.
Take a look at the demo here: https://github.com/rilwis/meta-box/blob/master/demo/media-modal.php
February 18, 2017 at 5:16 AM #5130sociality
ParticipantHello,
Thank you. I installed the development version and I got some errors such as
Fatal error: Uncaught Error: Call to a member function get_source_lang_code() on null in /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-content/plugins/meta-box-master/inc/wpml.php:97 Stack trace: #0 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-includes/class-wp-hook.php(298): RWMB_WPML->modify_field(Array) #1 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-includes/plugin.php(203): WP_Hook->apply_filters(Array, Array) #2 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-content/plugins/meta-box-master/inc/meta-box.php(320): apply_filters('rwmb_normalize_...', Array) #3 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-content/plugins/meta-box-master/inc/meta-box.php(46): RW_Meta_Box::normalize_fields(Array) #4 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-content/plugins/meta-box-master/inc/core.php(62): RW_Meta_Box->__construct(Array) #5 /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-includes/class-wp-hook.php(298): RWMB_Core->register_meta_boxes('') #6 /home/so in /home/socia979/public_html/coloursofajourney.eu/cOlJ/wp-content/plugins/meta-box-master/inc/wpml.php on line 97
Are you sure I can use this version for a production environment?
February 20, 2017 at 8:08 AM #5135Anh Tran
KeymasterSorry, I missed a check for WPML which causes the Fatal error. Please try again.
February 20, 2017 at 4:19 PM #5138sociality
ParticipantAlright,
It worked. You can close the thread 🙂
-
AuthorPosts
- The topic ‘Metas for Attachment Post Type’ is closed to new replies.