Created
May 21, 2012 11:02
-
-
Save imjjss/2761828 to your computer and use it in GitHub Desktop.
modified file_gallery_check_attachment_originality for single post_id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'admin_footer', 'file_gallery_check_attachment_originality' )); | |
function press_gallery_check_attachment_originality() { | |
$find_screen = - 1; | |
if (is_admin ()) { | |
$find_screen = ('upload' == get_current_screen ()->base) ? 1 : 0; | |
} else { | |
$find_screen = ('create' == xxx_view () || 'edit' == xxx_view ()) ? 1 : 0; | |
} | |
if ($find_screen != - 1 && ! empty ( $_POST ['found_post_id'] )) { | |
$id = $_POST ['found_post_id']; | |
$copy = ''; | |
$original = ''; | |
if (! empty ( $id )) { | |
$a = get_post_meta ( $id, '_has_copies' ); | |
$b = get_post_meta ( $id, '_is_copy_of' ) ; | |
$original = ! empty ( $a ) ? $id : ''; | |
$copy = ! empty ( $b ) ? $id : ''; | |
} | |
if (! empty ( $original ) || ! empty ( $copiy )) { | |
$original = ! empty ( $original ) ? '"#post-' . $original : 'null'; | |
$copy = ! empty ( $copy ) ? '"#post-' . $copy : 'null'; | |
} | |
?> | |
<script type="text/javascript"> | |
var file_gallery_originals = <?php echo $original; ?>, | |
file_gallery_copies = <?php echo $copy; ?>; | |
if( null !== file_gallery_originals) | |
jQuery(file_gallery_originals).addClass("attachment-original"); | |
if( null !== file_gallery_copies) | |
jQuery(file_gallery_copies).addClass("attachment-copy"); | |
</script> | |
<?php | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment