Post and page management filter additions from mdawaffe. see #3945

git-svn-id: https://develop.svn.wordpress.org/trunk@5587 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-05-29 04:28:10 +00:00
parent c4bb18caa6
commit 442ef7253a
5 changed files with 101 additions and 58 deletions

View File

@@ -284,7 +284,7 @@ function wp_upload_posts_where( $where ) {
}
function wp_upload_tab_browse() {
global $wpdb, $action, $paged;
global $action, $paged;
$old_vars = compact( 'paged' );
switch ( $action ) :
@@ -301,11 +301,7 @@ function wp_upload_tab_browse() {
add_action( 'pre_get_posts', 'wp_upload_grab_attachments' );
if ( 'browse' == $tab && $post_id )
add_filter( 'posts_where', 'wp_upload_posts_where' );
$attachments = query_posts("what_to_show=posts&posts_per_page=10&paged=$paged");
$count_query = "SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'attachment'";
if ( $post_id )
$count_query .= " AND post_parent = '$post_id'";
$total = $wpdb->get_var($count_query);
$attachments = query_posts("what_to_show=posts&post_status=any&posts_per_page=10&paged=$paged");
echo "<ul id='upload-files'>\n";
if ( have_posts() ) : while ( have_posts() ) : the_post();
@@ -357,4 +353,4 @@ function wp_upload_admin_head() {
}
}
?>
?>