From 1ce61ffda7f5b31a1a869593c40504a0a5b2b27b Mon Sep 17 00:00:00 2001
From: Andrew Nacin
Date: Fri, 15 Nov 2013 20:39:37 +0000
Subject: [PATCH] Merge wp_dashboard_recent_quickdrafts() into
wp_dashboard_quick_press(). see #25824.
git-svn-id: https://develop.svn.wordpress.org/trunk@26221 602fd350-edb4-49c9-b593-d223f7449a82
---
src/wp-admin/css/wp-admin.css | 14 +++---
src/wp-admin/includes/dashboard.php | 76 ++++++++++-------------------
2 files changed, 33 insertions(+), 57 deletions(-)
diff --git a/src/wp-admin/css/wp-admin.css b/src/wp-admin/css/wp-admin.css
index 917516c452..8eeb7ab33b 100644
--- a/src/wp-admin/css/wp-admin.css
+++ b/src/wp-admin/css/wp-admin.css
@@ -3093,27 +3093,27 @@ form.initial-form.quickpress-open input#title {
font-weight: normal;
}
-#draft-list {
+#dashboard_quick_press .drafts ul {
margin: 0;
}
-#draft-list li {
+#dashboard_quick_press .drafts li {
margin-bottom: 1em;
}
-#draft-list li time {
+#dashboard_quick_press .drafts li time {
color: #bbb;
}
-#draft-list p {
+#dashboard_quick_press .drafts p {
margin: 0;
}
-#draft-list .draft-title {
+#dashboard_quick_press .draft-title {
overflow: hidden;
}
-#draft-list .draft-title a,
-#draft-list .draft-title time {
+#dashboard_quick_press .draft-title a,
+#dashboard_quick_press .draft-title time {
float: left;
margin: 0 5px 0 0;
}
diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php
index 90fe304112..1c38c82621 100644
--- a/src/wp-admin/includes/dashboard.php
+++ b/src/wp-admin/includes/dashboard.php
@@ -337,63 +337,39 @@ function wp_dashboard_quick_press( $error_msg=false ) {
-
- 'post',
'post_status' => 'draft',
- 'author' => $GLOBALS['current_user']->ID,
+ 'author' => get_current_user_id(),
'posts_per_page' => 4,
'orderby' => 'modified',
'order' => 'DESC'
);
- $query_args = apply_filters( 'dash_recent_quickdrafts_query_args', $query_args );
- $drafts_query = new WP_Query( $query_args );
- $drafts =& $drafts_query->posts;
-
-
- if ( $drafts && is_array( $drafts ) ) {
- $list = array();
- $draft_count = 0;
- foreach ( $drafts as $draft ) {
- if ( 3 == $draft_count )
- break;
-
- $draft_count++;
-
- $url = get_edit_post_link( $draft->ID );
- $title = _draft_or_post_title( $draft->ID );
- $item = '';
- if ( $the_content = wp_trim_words( $draft->post_content, 10 ) )
- $item .= '' . $the_content . '
';
- $list[] = $item;
- }
-
- do_action( 'dashboard_quickdraft_drafts_list', $drafts );
-?>
-
-';
+ if ( count( $drafts ) > 3 ) {
+ echo '' . _x( 'View all', 'drafts' ) . "
\n";
+ }
+ echo '' . __( 'Drafts' ) . "
\n";
+
+ $drafts = array_slice( $drafts, 0, 3 );
+ foreach ( $drafts as $draft ) {
+ $url = get_edit_post_link( $draft->ID );
+ $title = _draft_or_post_title( $draft->ID );
+ echo "- \n";
+ echo '';
+ if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) {
+ echo '
' . $the_content . '
';
+ }
+ echo " \n";
+ }
+ echo "
\n";
}
function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {