Removing delete permanently button in uploading files media

This might do the trick! css: .media-sidebar .details .edit-attachment { display: none; } .media-sidebar .details .delete-attachment { display: none; } And this: foreach( array( ‘post.php’, ‘post-new.php’ ) as $hook ) add_action( “admin_print_styles-$hook”, ‘admin_styles_so_25894288’); function admin_styles_so_25894288() { global $typenow; if( ‘post’ !== $typenow ) return; ?> <style> .media-sidebar .details .delete-attachment { display: block; } .media-sidebar .details … Read more

WP Media Uploader modal conflicts with Bootstrap modal

Just proxy the modal-open class for Bootstrap like this: .bs-modal-open { overflow: hidden; } .bs-modal-open .modal { overflow-x: hidden; overflow-y: auto; } // or using sass … .bs-modal-open { @extend .modal-open; } Add/remove the bs-modal-open class to the body when opening/closing a BS modal: $(‘.bs-modal’) .on(‘show.bs.modal’, function (e) { $(‘body’).addClass(‘bs-modal-open’); }) .on(‘hidden.bs.modal’, function (e) { … Read more

wordpress thumbnail onclick then modal will come out

Easiest way would be to just grab an existing modal library and enqueue that to your theme. Bootstrap would work (although it would be excessive if you only need a modal window), just enqueue your bootstraps CSS and JavaScript files in your functions.php in your child theme and then you can create the appropriate classes … Read more

Displaying a specific sub-category’s posts from wp_query

You can do it by manipulating the WP_Query arguments like below- $idObj = get_category_by_slug(‘water-pumps-modal’); $args1 = array( ‘post_type’ => ‘post’, /*’category_name’ => ‘modal’,*/ ‘category__in’ => array( $idObj->term_id ), // Take only IDs of the categories ‘posts_per_page’ => ‘1’, );

wp_enqueue_media(); in multiple widgets

Your actual issue is that you are using $(‘.custom_media_url’).val(attachment.url); without selecting the exact field you need. This selects every .custom_media_url field on the page, e.g. each field within each widget. Since you are using jQuery, you can replace this line: $(‘.custom_media_url’).val(attachment.url); with $( e.target ).siblings( ‘.custom_media_url’ ).val( attachment.url ) However, using wp.media.editor is not the … Read more

How to create different media uploader frames / filter library depending on a custom action

You will have to create two different media modals that are fired depending on your click event. Here is some code from a recent project where I added these buttons to the tinyMCE visual editor: jQuery(document).ready(function($){ $(document).on(‘click’, ‘.mce-my_upload_button’, upload_image_tinymce); $(document).on(‘click’, ‘.mce-my_upload_pdf_button’, upload_pdf_tinymce); function upload_image_tinymce(e) { e.preventDefault(); var $input_field = $(‘.mce-my_input_image’); var custom_uploader = wp.media.frames.file_frame = … Read more