Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/js/_enqueues/admin/edit-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ var getCount, updateCount, updateCountText, updatePending, updateApproved,
return;
}

$( '.comment-count a', '#dashboard_right_now' ).text( response.i18n_comments_text );
$( '.comment-count .comments-count-text', '#dashboard_right_now' ).text( response.i18n_comments_text );
};

/**
Expand Down
65 changes: 38 additions & 27 deletions src/wp-admin/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -433,53 +433,64 @@

/* Right Now specific Icons styles */

#dashboard_right_now .search-engines-info::before,
#dashboard_right_now li a::before,
#dashboard_right_now li > span::before { /* get only the first level span to exclude screen-reader-text in mu-storage */
#dashboard_right_now li > span::before {
padding: 0 5px 0 0;
/* generic icon for items added by CPTs ? */
content: "\f159";
content: "\f159" / "";
}

#dashboard_right_now .page-count a::before,
#dashboard_right_now .page-count span::before {
content: "\f105";
content: "\f105" / "";
}

#dashboard_right_now .post-count a::before,
#dashboard_right_now .post-count span::before {
content: "\f109";
content: "\f109" / "";
}

#dashboard_right_now .comment-count a::before {
content: "\f101";
content: "\f101" / "";
/*
* Default icon for plugin-added items: a copy of the core `asterisk` icon.
* Plugins can still override `content` with a Dashicon.
*/
content: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2024%2024%22%20style%3D%22fill%3A%20none%22%20stroke%3D%22%23646970%22%20stroke-width%3D%221.5%22%3E%3Cpath%20d%3D%22M5.72131%2015.625L12%2012M12%2012L18.2787%208.375M12%2012V4.75M12%2012L12%2019.25M12%2012L5.72131%208.375M12%2012L18.2787%2015.625%22%20stroke-linecap%3D%22square%22%20%2F%3E%3C%2Fsvg%3E");
content: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2024%2024%22%20style%3D%22fill%3A%20none%22%20stroke%3D%22%23646970%22%20stroke-width%3D%221.5%22%3E%3Cpath%20d%3D%22M5.72131%2015.625L12%2012M12%2012L18.2787%208.375M12%2012V4.75M12%2012L12%2019.25M12%2012L5.72131%208.375M12%2012L18.2787%2015.625%22%20stroke-linecap%3D%22square%22%20%2F%3E%3C%2Fsvg%3E") / "";
}

/* Fallbacks for when the SVG icons are unavailable. */
#dashboard_right_now .comment-mod-count a::before {
content: "\f125";
content: "\f125" / "";
}

#dashboard_right_now .storage-count a::before {
content: "\f104";
content: "\f104" / "";
}

#dashboard_right_now .storage-count.warning a::before {
content: "\f153";
content: "\f153" / "";
}

#dashboard_right_now .search-engines-info::before {
padding: 0 5px 0 0;
content: "\f348";
content: "\f348" / "";
color: #d63638;
}

#dashboard_right_now li a:has(> svg)::before,
#dashboard_right_now li > span:has(> svg)::before,
#dashboard_right_now .search-engines-info:has(svg)::before {
display: none;
}

#dashboard_right_now li a:has(> svg),
#dashboard_right_now li > span:has(> svg),
#dashboard_right_now .search-engines-info a {
display: inline-flex;
align-items: center;
gap: 5px;
/* Match the height of ::before icon rows so the floated list items don't snag. */
vertical-align: top;
}

#dashboard_right_now li a > svg,
#dashboard_right_now li > span > svg,
#dashboard_right_now .search-engines-info svg {
flex: none;
fill: currentColor;
color: #646970;
}

#dashboard_right_now .warning a > svg,
#dashboard_right_now .search-engines-info svg {
color: #d63638;
}

/* Dashboard WordPress events */

.community-events-errors {
Expand Down
22 changes: 13 additions & 9 deletions src/wp-admin/includes/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ function wp_dashboard_right_now() {

$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
$post_type_object = get_post_type_object( $post_type );
$icon = wp_get_icon( 'post' === $post_type ? 'core-admin/pin' : 'core-admin/page', array( 'size' => 20 ) );

if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) {
$url = add_query_arg(
Expand All @@ -358,9 +359,9 @@ function wp_dashboard_right_now() {
),
admin_url( 'edit.php' )
);
printf( '<li class="%1$s-count"><a href="%2$s">%3$s</a></li>', $post_type, esc_url( $url ), esc_html( $text ) );
printf( '<li class="%1$s-count"><a href="%2$s">%3$s%4$s</a></li>', $post_type, esc_url( $url ), $icon, esc_html( $text ) );
} else {
printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text );
printf( '<li class="%1$s-count"><span>%2$s%3$s</span></li>', $post_type, $icon, esc_html( $text ) );
}
}
}
Expand All @@ -373,15 +374,15 @@ function wp_dashboard_right_now() {
$text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) );
?>
<li class="comment-count">
<a href="edit-comments.php"><?php echo $text; ?></a>
<a href="edit-comments.php"><?php echo wp_get_icon( 'core-admin/comment', array( 'size' => 20 ) ); ?><span class="comments-count-text"><?php echo $text; ?></span></a>
</li>
<?php
$moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated );
/* translators: %s: Number of comments. */
$text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $num_comm->moderated ), $moderated_comments_count_i18n );
?>
<li class="comment-mod-count<?php echo ! $num_comm->moderated ? ' hidden' : ''; ?>">
<a href="edit-comments.php?comment_status=moderated" class="comments-in-moderation-text"><?php echo $text; ?></a>
<a href="edit-comments.php?comment_status=moderated"><?php echo wp_get_icon( 'core-admin/post-comments', array( 'size' => 20 ) ); ?><span class="comments-in-moderation-text"><?php echo $text; ?></span></a>
</li>
<?php
}
Expand Down Expand Up @@ -440,7 +441,8 @@ function wp_dashboard_right_now() {

$title_attr = '' === $title ? '' : " title='$title'";

echo "<p class='search-engines-info'><a href='options-reading.php'$title_attr>$content</a></p>";
$icon = wp_get_icon( 'core-admin/info', array( 'size' => 20 ) );
echo "<p class='search-engines-info'><a href='options-reading.php'$title_attr>$icon$content</a></p>";
}
?>
</div>
Expand Down Expand Up @@ -1921,11 +1923,12 @@ function wp_dashboard_quota() {
number_format_i18n( $quota )
);
printf(
'<a href="%1$s">%2$s<span class="screen-reader-text"> (%3$s)</span></a>',
'<a href="%1$s">%4$s%2$s<span class="screen-reader-text"> (%3$s)</span></a>',
esc_url( admin_url( 'upload.php' ) ),
$text,
/* translators: Hidden accessibility text. */
__( 'Manage Uploads' )
__( 'Manage Uploads' ),
wp_get_icon( 'core-admin/media', array( 'size' => 20 ) )
);
?>
</li><li class="storage-count <?php echo $used_class; ?>">
Expand All @@ -1937,11 +1940,12 @@ function wp_dashboard_quota() {
$percentused
);
printf(
'<a href="%1$s" class="musublink">%2$s<span class="screen-reader-text"> (%3$s)</span></a>',
'<a href="%1$s" class="musublink">%4$s%2$s<span class="screen-reader-text"> (%3$s)</span></a>',
esc_url( admin_url( 'upload.php' ) ),
$text,
/* translators: Hidden accessibility text. */
__( 'Manage Uploads' )
__( 'Manage Uploads' ),
wp_get_icon( $used_class ? 'core-admin/error' : 'core-admin/media', array( 'size' => 20 ) )
);
?>
</li>
Expand Down
Loading