Display 15 posts. Remove no longer needed add-post AJAX action. Props johnhennmacc. fixes #6264
git-svn-id: https://develop.svn.wordpress.org/trunk@7352 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
06db41b417
commit
eae7b967de
|
@ -22,23 +22,6 @@ if ( isset($_GET['action']) && 'ajax-tag-search' == $_GET['action'] ) {
|
||||||
|
|
||||||
$id = isset($_POST['id'])? (int) $_POST['id'] : 0;
|
$id = isset($_POST['id'])? (int) $_POST['id'] : 0;
|
||||||
switch ( $action = $_POST['action'] ) :
|
switch ( $action = $_POST['action'] ) :
|
||||||
case 'add-post' :
|
|
||||||
check_ajax_referer( 'add-post' );
|
|
||||||
add_filter( 'post_limits', $limit_filter = create_function( '$a', '$b = split(" ",$a); if ( !isset($b[2]) ) return $a; $start = intval(trim($b[1])) / 20 * 15; if ( !is_int($start) ) return $a; $start += intval(trim($b[2])) - 1; return "LIMIT $start, 1";' ) );
|
|
||||||
wp_edit_posts_query( $_POST );
|
|
||||||
if ( !have_posts() )
|
|
||||||
die('1');
|
|
||||||
$posts_columns = wp_manage_posts_columns();
|
|
||||||
ob_start();
|
|
||||||
include( 'edit-post-rows.php' );
|
|
||||||
$data = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
if ( !preg_match('|<tbody.+?>(.+)</tbody>|s', $data, $matches) )
|
|
||||||
my_dump($data);
|
|
||||||
$data = trim($matches[1]);
|
|
||||||
$x = new WP_Ajax_Response( array( 'what' => 'post', 'id' => $id, 'data' => $data ) );
|
|
||||||
$x->send();
|
|
||||||
break;
|
|
||||||
case 'delete-comment' :
|
case 'delete-comment' :
|
||||||
check_ajax_referer( "delete-comment_$id" );
|
check_ajax_referer( "delete-comment_$id" );
|
||||||
if ( !$comment = get_comment( $id ) )
|
if ( !$comment = get_comment( $id ) )
|
||||||
|
|
|
@ -547,7 +547,7 @@ function wp_edit_posts_query( $q = false ) {
|
||||||
$orderby = 'date';
|
$orderby = 'date';
|
||||||
}
|
}
|
||||||
|
|
||||||
wp("post_type=post&what_to_show=posts$post_status_q&posts_per_page=20&order=$order&orderby=$orderby");
|
wp("post_type=post&what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby");
|
||||||
|
|
||||||
return array($post_stati, $avail_post_stati);
|
return array($post_stati, $avail_post_stati);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue