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;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#draft-list {
|
#dashboard_quick_press .drafts ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#draft-list li {
|
#dashboard_quick_press .drafts li {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
#draft-list li time {
|
#dashboard_quick_press .drafts li time {
|
||||||
color: #bbb;
|
color: #bbb;
|
||||||
}
|
}
|
||||||
|
|
||||||
#draft-list p {
|
#dashboard_quick_press .drafts p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#draft-list .draft-title {
|
#dashboard_quick_press .draft-title {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#draft-list .draft-title a,
|
#dashboard_quick_press .draft-title a,
|
||||||
#draft-list .draft-title time {
|
#dashboard_quick_press .draft-title time {
|
||||||
float: right;
|
float: right;
|
||||||
margin: 0 0 0 5px;
|
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;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
#draft-list {
|
#dashboard_quick_press .drafts ul {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#draft-list li {
|
#dashboard_quick_press .drafts li {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
#draft-list li time {
|
#dashboard_quick_press .drafts li time {
|
||||||
color: #bbb;
|
color: #bbb;
|
||||||
}
|
}
|
||||||
|
|
||||||
#draft-list p {
|
#dashboard_quick_press .drafts p {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#draft-list .draft-title {
|
#dashboard_quick_press .draft-title {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#draft-list .draft-title a,
|
#dashboard_quick_press .draft-title a,
|
||||||
#draft-list .draft-title time {
|
#dashboard_quick_press .draft-title time {
|
||||||
float: left;
|
float: left;
|
||||||
margin: 0 5px 0 0;
|
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>
|
</p>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
<?php
|
||||||
<?php
|
|
||||||
wp_dashboard_recent_quickdrafts();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show `Recent Drafts` below Quick Draft form
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @since 3.8.0
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function wp_dashboard_recent_quickdrafts() {
|
|
||||||
|
|
||||||
$query_args = array(
|
$query_args = array(
|
||||||
'post_type' => 'post',
|
'post_type' => 'post',
|
||||||
'post_status' => 'draft',
|
'post_status' => 'draft',
|
||||||
'author' => $GLOBALS['current_user']->ID,
|
'author' => get_current_user_id(),
|
||||||
'posts_per_page' => 4,
|
'posts_per_page' => 4,
|
||||||
'orderby' => 'modified',
|
'orderby' => 'modified',
|
||||||
'order' => 'DESC'
|
'order' => 'DESC'
|
||||||
);
|
);
|
||||||
$query_args = apply_filters( 'dash_recent_quickdrafts_query_args', $query_args );
|
$drafts = get_posts( $query_args );
|
||||||
$drafts_query = new WP_Query( $query_args );
|
if ( ! $drafts ) {
|
||||||
$drafts =& $drafts_query->posts;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
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>";
|
||||||
|
|
||||||
if ( $drafts && is_array( $drafts ) ) {
|
$drafts = array_slice( $drafts, 0, 3 );
|
||||||
$list = array();
|
foreach ( $drafts as $draft ) {
|
||||||
$draft_count = 0;
|
$url = get_edit_post_link( $draft->ID );
|
||||||
foreach ( $drafts as $draft ) {
|
$title = _draft_or_post_title( $draft->ID );
|
||||||
if ( 3 == $draft_count )
|
echo "<li>\n";
|
||||||
break;
|
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>';
|
||||||
$draft_count++;
|
if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) {
|
||||||
|
echo '<p>' . $the_content . '</p>';
|
||||||
$url = get_edit_post_link( $draft->ID );
|
}
|
||||||
$title = _draft_or_post_title( $draft->ID );
|
echo "</li>\n";
|
||||||
$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 ) )
|
echo "</ul>\n</div>";
|
||||||
$item .= '<p>' . $the_content . '</p>';
|
|
||||||
$list[] = $item;
|
|
||||||
}
|
|
||||||
|
|
||||||
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 }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
|
function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
|
||||||
|
|
Loading…
Reference in New Issue