0

Is it possible to show the media-library on a frontend template?

I need to use the media-library (/wp-admin/upload.php) as part of a frontend page design with some modifications. I dont want to use the upload-functionality but the list of all images and the functionality you have when clicking on one image... So, I need the css, php and js code of the wordpress media-library.

I could code this from scracth but I like the idea to re-use the wordpress-core code. Where can I find the code in the wp-admin folder and how can i integrate this code on frontend? Thanks alot

Edit:

i dont want to use media uploader i want to display the content of the media library on a page with (more or less) same design and fuctionality as in the backend.

like on this sketch:

enter image description here

1 Answer 1

0

Add below code to your current theme's function.php

function add_media_upload_scripts() {
    if ( is_admin() ) {
         return;
       }
    wp_enqueue_media();
}
add_action('wp_enqueue_scripts', 'add_media_upload_scripts');

Further, you can explore more in detail by follow this blog (i.e. https://codestag.com/how-to-use-wordpress-3-5-media-uploader-in-theme-options/)

2
  • thanks, i edited my question to make it more clear what i need to achieve.
    – buckdanny
    Oct 27, 2016 at 12:55
  • I'm not fond of the implementation but the answer to my problem with the Media Library not loading in the frontend was to use wp_enqueue_media()
    – Tami
    May 21, 2023 at 23:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.