Merge wp_dashboard_recent_quickdrafts() into wp_dashboard_quick_press(). see #25824.
Built from https://develop.svn.wordpress.org/trunk@26221 git-svn-id: http://core.svn.wordpress.org/trunk@26129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2cc8ed1594
commit
963b2aa574
|
@ -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: right;
|
||||
margin: 0 0 0 5px;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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;
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -337,63 +337,39 @@ function wp_dashboard_quick_press( $error_msg=false ) {
|
|||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
<?php
|
||||
wp_dashboard_recent_quickdrafts();
|
||||
}
|
||||
|
||||
/**
|
||||
* Show `Recent Drafts` below Quick Draft form
|
||||
*
|
||||
*
|
||||
*
|
||||
* @since 3.8.0
|
||||
*
|
||||
*/
|
||||
function wp_dashboard_recent_quickdrafts() {
|
||||
|
||||
$query_args = array(
|
||||
'post_type' => '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 = '<div class="draft-title"><a href="' . $url . '" title="' . sprintf( __( 'Edit “%s”' ), esc_attr( $title ) ) . '">' . esc_html( $title ) . '</a> <time datetime="' . get_the_time( 'c', $draft) . '">' . get_the_time( get_option( 'date_format' ), $draft ) . '</time></div>';
|
||||
if ( $the_content = wp_trim_words( $draft->post_content, 10 ) )
|
||||
$item .= '<p>' . $the_content . '</p>';
|
||||
$list[] = $item;
|
||||
$drafts = get_posts( $query_args );
|
||||
if ( ! $drafts ) {
|
||||
return;
|
||||
}
|
||||
|
||||
do_action( 'dashboard_quickdraft_drafts_list', $drafts );
|
||||
?>
|
||||
<div class="drafts">
|
||||
<?php if ( 3 < count($drafts) ) { ?>
|
||||
<p class="view-all"><a href="edit.php?post_status=draft" ><?php _e( 'View all' ); ?></a></p>
|
||||
<?php } ?>
|
||||
<h4><?php _e('Drafts'); ?></h4>
|
||||
<ul id="draft-list">
|
||||
<li><?php echo join( "</li>\n<li>", $list ); ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php }
|
||||
echo '<div class="drafts">';
|
||||
if ( count( $drafts ) > 3 ) {
|
||||
echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '">' . _x( 'View all', 'drafts' ) . "</a></p>\n";
|
||||
}
|
||||
echo '<h4>' . __( 'Drafts' ) . "</h4>\n<ul>";
|
||||
|
||||
$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 "<li>\n";
|
||||
echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . esc_html( $title ) . '</a>';
|
||||
echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( get_option( 'date_format' ), $draft ) . '</time></div>';
|
||||
if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) {
|
||||
echo '<p>' . $the_content . '</p>';
|
||||
}
|
||||
echo "</li>\n";
|
||||
}
|
||||
echo "</ul>\n</div>";
|
||||
}
|
||||
|
||||
function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
|
||||
|
|
Loading…
Reference in New Issue