Changeset 26221 for trunk/src/wp-admin/includes/dashboard.php
- Timestamp:
- 11/15/2013 08:39:37 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/includes/dashboard.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)