Changeset 26221
- Timestamp:
- 11/15/2013 08:39:37 PM (12 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/css/wp-admin.css
r26220 r26221 3094 3094 } 3095 3095 3096 #d raft-list{3096 #dashboard_quick_press .drafts ul { 3097 3097 margin: 0; 3098 3098 } 3099 3099 3100 #d raft-listli {3100 #dashboard_quick_press .drafts li { 3101 3101 margin-bottom: 1em; 3102 3102 } 3103 #d raft-listli time {3103 #dashboard_quick_press .drafts li time { 3104 3104 color: #bbb; 3105 3105 } 3106 3106 3107 #d raft-listp {3107 #dashboard_quick_press .drafts p { 3108 3108 margin: 0; 3109 3109 } 3110 3110 3111 #d raft-list.draft-title {3111 #dashboard_quick_press .draft-title { 3112 3112 overflow: hidden; 3113 3113 } 3114 3114 3115 #d raft-list.draft-title a,3116 #d raft-list.draft-title time {3115 #dashboard_quick_press .draft-title a, 3116 #dashboard_quick_press .draft-title time { 3117 3117 float: left; 3118 3118 margin: 0 5px 0 0; -
trunk/src/wp-admin/includes/dashboard.php
r26220 r26221 338 338 339 339 </form> 340 341 <?php 342 wp_dashboard_recent_quickdrafts(); 343 } 344 345 /** 346 * Show `Recent Drafts` below Quick Draft form 347 * 348 * 349 * 350 * @since 3.8.0 351 * 352 */ 353 function wp_dashboard_recent_quickdrafts() { 354 340 <?php 355 341 $query_args = array( 356 342 'post_type' => 'post', 357 343 'post_status' => 'draft', 358 'author' => $GLOBALS['current_user']->ID,344 'author' => get_current_user_id(), 359 345 'posts_per_page' => 4, 360 346 'orderby' => 'modified', 361 347 'order' => 'DESC' 362 348 ); 363 $query_args = apply_filters( 'dash_recent_quickdrafts_query_args', $query_args ); 364 $drafts_query = new WP_Query( $query_args ); 365 $drafts =& $drafts_query->posts; 366 367 368 if ( $drafts && is_array( $drafts ) ) { 369 $list = array(); 370 $draft_count = 0; 371 foreach ( $drafts as $draft ) { 372 if ( 3 == $draft_count ) 373 break; 374 375 $draft_count++; 376 377 $url = get_edit_post_link( $draft->ID ); 378 $title = _draft_or_post_title( $draft->ID ); 379 $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>'; 380 if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) 381 $item .= '<p>' . $the_content . '</p>'; 382 $list[] = $item; 383 } 384 385 do_action( 'dashboard_quickdraft_drafts_list', $drafts ); 386 ?> 387 <div class="drafts"> 388 <?php if ( 3 < count($drafts) ) { ?> 389 <p class="view-all"><a href="edit.php?post_status=draft" ><?php _e( 'View all' ); ?></a></p> 390 <?php } ?> 391 <h4><?php _e('Drafts'); ?></h4> 392 <ul id="draft-list"> 393 <li><?php echo join( "</li>\n<li>", $list ); ?></li> 394 </ul> 395 </div> 396 <?php } 349 $drafts = get_posts( $query_args ); 350 if ( ! $drafts ) { 351 return; 352 } 353 354 echo '<div class="drafts">'; 355 if ( count( $drafts ) > 3 ) { 356 echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '">' . _x( 'View all', 'drafts' ) . "</a></p>\n"; 357 } 358 echo '<h4>' . __( 'Drafts' ) . "</h4>\n<ul>"; 359 360 $drafts = array_slice( $drafts, 0, 3 ); 361 foreach ( $drafts as $draft ) { 362 $url = get_edit_post_link( $draft->ID ); 363 $title = _draft_or_post_title( $draft->ID ); 364 echo "<li>\n"; 365 echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . esc_html( $title ) . '</a>'; 366 echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( get_option( 'date_format' ), $draft ) . '</time></div>'; 367 if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) { 368 echo '<p>' . $the_content . '</p>'; 369 } 370 echo "</li>\n"; 371 } 372 echo "</ul>\n</div>"; 397 373 } 398 374
Note: See TracChangeset
for help on using the changeset viewer.