WordPress.org

Ready to get started?Download WordPress

Forums

Media Library Support in Custom Fields (6 posts)

  1. Shaun
    Member
    Posted 3 years ago #

    I have modified the core code to intercept the functionality of the media library so that rather than inserting the selected file to the post body, it passes the file url back to be used in custom fields of a custom post type.

    It would be nice if there was a way to say we wanted to load a file (image/sound/video/etc) via the media library somehow.

    I know my methods aren't the best, but I would be willing to help out if I could in anyway. It's discomforting knowing I had to modify core code, and if the client updates I will have to fix it all over again.

  2. spacechampion
    Member
    Posted 3 years ago #

    I'm not sure why you had to modify the core. I have a video plugin I created that attaches video files and poster images from the media library to a custom post type called video.

    Granted, it doesn't do this within the video post using the Add Media link above the Visual Editor -- instead I have to go to the media library and attach to the post there. But since I am attaching multiples files at once it works for me.

    Did you have to modify the core because the Visual Editor can't be modified with a plugin?

  3. Shaun
    Member
    Posted 3 years ago #

    I created a custom post type that has additional meta boxes, when i used the insert image/audio it only inserts to the post body.

    The modifications I made allow a button in the custom meta box call the media library popup, and replaces the "Insert into Post" button with a "Use this File" button that passes the file url back to the calling field rather than inserting it into the post body.

    This way I, or in this case the client, can upload a sound file directly to a custom post field

  4. spacechampion
    Member
    Posted 3 years ago #

    I see. Which core files did you modify? I would be interested in seeing the code. Maybe a plugin would be possible to develop.

  5. Shaun
    Member
    Posted 3 years ago #

    I believe it was /wp-admin/includes/media.php, /wp-admin/media-upload.php & /wp-admin/async-upload.php

    I documented all of my changes if you would like me to email them to you. I just can't get to the file right now as the clients host seems to be having issues.

  6. spacechampion
    Member
    Posted 3 years ago #

    Yes, thanks. Please email me here

Topic Closed

This topic has been closed to new replies.

About this Topic