Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into media_element_audio

* 'master' of https://github.com/WordPress/twentynineteen: (37 commits)
  Minor formatting fix, hide navigation menus
  Add @nielslange to contributors.md
  Replicate Gutenberg link hover behavior
  Add underline to links within comments.
  Use theme version as print style version number
  Adding styling for the comment form label(s)
  Replace border-bottom with text-decoration
  Add @audrasjb to CONTRIBUTORS.md
  Remove `twentynineteen_get_estimated_reading_time` following WordPress#168.
  Replace site title h1 tag with p when not on homepage.
  Adding compiled CSS from WordPress#106
  Fixes a fatal error that mysteriously slipped by Travis checks
  Add @khleomix to contributors.md
  remove rule for wp-config-sample and txt files
  Clear whitespace. Again.
  Fix formatting, make Travis happy
  Underline links within content
  Recompile SASS
  Add pullquote <em> font-style to style-editor CSS rules
  removed min-height entirely
  ...
  • Loading branch information
mmaumio committed Oct 20, 2018
2 parents 2ea1597 + 4b77b4b commit 988186a
Show file tree
Hide file tree
Showing 22 changed files with 480 additions and 157 deletions.
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[{package.json,*.yml}]
[*.yml]
indent_style = space
indent_size = 2

[{*.txt,wp-config-sample.php}]
end_of_line = crlf
[*.md]
trim_trailing_whitespace = false
3 changes: 3 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ Version 1.0:
@aaronjorbin
@netweb
@b-07
@khleomix
@audrasjb
@nielslange
2 changes: 1 addition & 1 deletion classes/class-twentynineteen-walker-comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ protected function html5_comment( $comment, $depth, $args ) {
<a href="<?php echo esc_url( get_comment_link( $comment, $args ) ); ?>">
<?php /* translators: 1: comment date, 2: comment time */ ?>
<time datetime="<?php comment_time( 'c' ); ?>" title="<?php printf( __( '%1$s at %2$s', 'twentynineteen' ), get_comment_date( '', $comment ), get_comment_time() ); ?>">
<?php echo twentynineteen_human_time_diff( get_comment_date( 'U' ) ); ?>
<?php printf( __( '%1$s at %2$s', 'twentynineteen' ), get_comment_date( '', $comment ), get_comment_time() ); ?>
</time>
</a>
<?php
Expand Down
2 changes: 1 addition & 1 deletion comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<?php
wp_list_comments(
array(
'walker' => new Twenty_Nineteen_Walker_Comment(),
'walker' => new TwentyNineteen_Walker_Comment(),
'avatar_size' => twentynineteen_get_avatar_size(),
'short_ping' => true,
'style' => 'ol',
Expand Down
2 changes: 2 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ function twentynineteen_scripts() {

wp_enqueue_script( 'twentynineteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );

wp_enqueue_style( 'twentynineteen-print-style', get_template_directory_uri() . '/print.css', array(), wp_get_theme()->get( 'Version' ), 'print' );

if ( is_singular() && twentynineteen_can_show_post_thumbnail() ) {
wp_add_inline_style( 'twentynineteen-style', twentynineteen_header_featured_image_css() );
}
Expand Down
2 changes: 1 addition & 1 deletion header.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<?php if ( ! is_page() ) : ?>
<div class="<?php echo ( ! empty( $discussion ) && count( $discussion->authors ) > 0 ) ? 'entry-meta has-discussion' : 'entry-meta'; ?>">
<?php twentynineteen_posted_by(); ?>
<?php twentynineteen_estimated_read_time(); ?>
<?php twentynineteen_posted_on(); ?>
<span class="comment-count">
<?php
if ( ! empty( $discussion ) ) {
Expand Down
9 changes: 0 additions & 9 deletions inc/template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,6 @@ function twentynineteen_can_show_post_thumbnail() {
return ! post_password_required() && ! is_attachment() && has_post_thumbnail();
}

/**
* Determines the estimated time to read a post, in minutes.
*/
function twentynineteen_get_estimated_reading_time() {
$content = get_post_field( 'post_content', get_the_ID() );
$count = str_word_count( strip_tags( $content ) );
return (int) round( $count / 250 ); // Assuming 250 words per minute reading speed.
}

/**
* Returns true if image filters are enabled on the theme options.
*/
Expand Down
89 changes: 6 additions & 83 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ function twentynineteen_posted_on() {
esc_html( get_the_modified_date() )
);

echo '<span class="posted-on"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a></span>'; // WPCS: XSS OK.

printf(
'<span class="posted-on">%1$s<a href="%2$s" rel="bookmark">' . $time_string . '</a></span>',
twentynineteen_get_icon_svg( 'watch', 16 ),
esc_url( get_permalink() ),
$time_string
);
}
endif;

Expand Down Expand Up @@ -62,28 +66,6 @@ function twentynineteen_comment_count() {
}
endif;

if ( ! function_exists( 'twentynineteen_estimated_read_time' ) ) :
/**
* Prints HTML with the estimated reading time. Does not display when time to read is zero.
*/
function twentynineteen_estimated_read_time() {
$minutes = twentynineteen_get_estimated_reading_time();
if ( 0 === $minutes ) {
return null;
}
$datetime_attr = sprintf( '%dm 0s', $minutes );
$read_time_text = sprintf( _nx( '%s Minute', '%s Minutes', $minutes, 'Time to read', 'twentynineteen' ), $minutes );
/* translators: 1: SVG icon. 2: Reading time label, only visible to screen readers. 3: The [datetime] attribute for the <time> tag. 4: Estimated reading time text, in minutes. */
printf(
'<span class="est-reading-time">%1$s<span class="screen-reader-text">%2$s</span><time datetime="%3$s">%4$s</time></span>',
twentynineteen_get_icon_svg( 'watch', 16 ),
__( 'Estimated reading time', 'twentynineteen' ),
$datetime_attr,
$read_time_text
);
}
endif;

if ( ! function_exists( 'twentynineteen_entry_footer' ) ) :
/**
* Prints HTML with meta information for the categories, tags and comments.
Expand Down Expand Up @@ -187,65 +169,6 @@ function twentynineteen_header_featured_image_css() {
}
endif;

if ( ! function_exists( 'twentynineteen_human_time_diff' ) ) :
/**
* Same as core's human_time_diff(), only in the "ago" context,
* which is different for some languages.
*
* @param int $from Unix timestamp from which the difference begins.
* @param int $to Optional Unix timestamp to end the time difference. Defaults to time() if not set.
* @return string Human readable time difference.
*/
function twentynineteen_human_time_diff( $from, $to = '' ) {
if ( empty( $to ) ) {
$to = time();
}

$diff = (int) abs( $to - $from );

if ( $diff < HOUR_IN_SECONDS ) {
$mins = round( $diff / MINUTE_IN_SECONDS );
if ( $mins <= 1 ) {
$mins = 1;
}
/* translators: min=minute */
$since = sprintf( _n( '%s min ago', '%s mins ago', $mins, 'twentynineteen' ), $mins );
} elseif ( $diff < DAY_IN_SECONDS && $diff >= HOUR_IN_SECONDS ) {
$hours = round( $diff / HOUR_IN_SECONDS );
if ( $hours <= 1 ) {
$hours = 1;
}
$since = sprintf( _n( '%s hour ago', '%s hours ago', $hours, 'twentynineteen' ), $hours );
} elseif ( $diff < WEEK_IN_SECONDS && $diff >= DAY_IN_SECONDS ) {
$days = round( $diff / DAY_IN_SECONDS );
if ( $days <= 1 ) {
$days = 1;
}
$since = sprintf( _n( '%s day ago', '%s days ago', $days, 'twentynineteen' ), $days );
} elseif ( $diff < 30 * DAY_IN_SECONDS && $diff >= WEEK_IN_SECONDS ) {
$weeks = round( $diff / WEEK_IN_SECONDS );
if ( $weeks <= 1 ) {
$weeks = 1;
}
$since = sprintf( _n( '%s week ago', '%s weeks ago', $weeks, 'twentynineteen' ), $weeks );
} elseif ( $diff < YEAR_IN_SECONDS && $diff >= 30 * DAY_IN_SECONDS ) {
$months = round( $diff / ( 30 * DAY_IN_SECONDS ) );
if ( $months <= 1 ) {
$months = 1;
}
$since = sprintf( _n( '%s month ago', '%s months ago', $months, 'twentynineteen' ), $months );
} elseif ( $diff >= YEAR_IN_SECONDS ) {
$years = round( $diff / YEAR_IN_SECONDS );
if ( $years <= 1 ) {
$years = 1;
}
$since = sprintf( _n( '%s year ago', '%s years ago', $years, 'twentynineteen' ), $years );
}

return $since;
}
endif;

if ( ! function_exists( 'twentynineteen_comment_avatar' ) ) :
/**
* Returns the HTML markup to generate a user avatar.
Expand Down
105 changes: 105 additions & 0 deletions print.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
@charset "UTF-8";
/*
Theme Name: Twenty Nineteen
Adding print support. The print styles are based on the the great work of
Andreas Hecht in https://www.jotform.com/blog/css-perfect-print-stylesheet-98272/.
*/
/*--------------------------------------------------------------
>>> TABLE OF CONTENTS:
----------------------------------------------------------------
# Margins
# Typography÷
# Page breaks
# Links
# Visibility
--------------------------------------------------------------*/
@media print {
/* Margins */
@page {
margin: 2cm;
}
.hentry .entry-header, .site-footer .site-info {
margin: 0;
}
/* Fonts */
body {
font: 13pt Georgia, "Times New Roman", Times, serif;
line-height: 1.3;
background: #fff !important;
color: #000;
}
h1 {
font-size: 24pt;
}
h2,
h3,
h4,
.has-regular-font-size,
.has-large-font-size,
h2.author-title,
p.author-bio,
.comments-title, h3 {
font-size: 14pt;
margin-top: 25px;
}
/* Page breaks */
a {
page-break-inside: avoid;
}
blockquote {
page-break-inside: avoid;
}
h1,
h2,
h3,
h4,
h5,
h6 {
page-break-after: avoid;
page-break-inside: avoid;
}
img {
page-break-inside: avoid;
page-break-after: avoid;
}
table, pre {
page-break-inside: avoid;
}
ul, ol, dl {
page-break-before: avoid;
}
/* Links */
a:link, a:visited, a {
background: transparent;
color: #520;
font-weight: bold;
text-decoration: underline;
text-align: left;
}
a {
page-break-inside: avoid;
}
a[href^=http]:after {
content: " < " attr(href) "> ";
}
a:after > img {
content: "";
}
article a[href^="#"]:after {
content: "";
}
a:not(:local-link):after {
content: " < " attr(href) "> ";
}
/* Visibility */
.main-navigation,
.social-navigation,
.site-branding-container:before,
.hentry .entry-title:before,
.entry-meta, .entry-footer,
.author-description:before,
.post-navigation {
display: none;
}
}
Loading

0 comments on commit 988186a

Please sign in to comment.