Inventory_Presser_Admin_Customize_Dashboard::create_delete_all_post_attachments_button()
create_delete_all_post_attachments_button
Contents
Description Description
Creates HTML that renders a button that says "Delete All Media" that will be placed near the Add Media button.
Return Return
(string)
Source Source
File: includes/admin/class-admin-customize-dashboard.php
function create_delete_all_post_attachments_button() { global $post; if ( ! is_object( $post ) || ! isset( $post->ID ) ) { return ''; } // does this post have attachments? $post = get_post( $post->ID ); if ( INVP::POST_TYPE != $post->post_type ) { return ''; } $attachments = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'posts_per_page' => -1, ) ); if ( 0 === sizeof( $attachments ) ) { return ''; } return sprintf( '<button type="button" id="delete-media-button" class="button" onclick="delete_all_post_attachments();">' . '<span class="wp-media-buttons-icon"></span> %s</button>', __( 'Delete All Media', 'inventory-presser' ) ); }
Expand full source code Collapse full source code View on Github