Add the following code to the functions. php file of the current topic:
The code is as follows: |
Copy code |
Add_filter ("manage_upload_columns", 'upload _ columns '); Add_action ("manage_media_custom_column", 'media _ custom_columns ', 0, 2 ); Function upload_columns ($ columns ){ Unset ($ columns ['parent']); $ Columns ['better _ parent'] = "parent "; Return $ columns; } Function media_custom_columns ($ column_name, $ id ){ $ Post = get_post ($ id ); If ($ column_name! = 'Better _ parent ') Return; If ($ post-> post_parent> 0 ){ If (get_post ($ post-> post_parent )){ $ Title = _ draft_or_post_title ($ post-> post_parent ); } ?> <Strong> <a href = "<? Php echo get_edit_post_link ($ post-> post_parent);?> "> <? Php echo $ title?> </A> </strong>, <? Php echo get_the_time (_ ('Y/m/D');?> <Br/> <A class = "hide-if-no-js" onclick = "findPosts. open ('media [] ',' <? Php echo $ post-> ID?> '); Return false; "href =" # the-list "> <? Php _ e ('Re-Attach ');?> </A> <? Php } Else { ?> <? Php _ e ('(Unattached)');?> <Br/> <A class = "hide-if-no-js" onclick = "findPosts. open ('media [] ',' <? Php echo $ post-> ID?> '); Return false; "href =" # the-list "> <? Php _ e ('Attach ');?> </A> <? Php } } |
Original article: http://zmingcx.com