| Conditions | 2 |
| Paths | 2 |
| Total Lines | 26 |
| Code Lines | 15 |
| Lines | 26 |
| Ratio | 100 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 14 | function _s_posted_on() { |
||
| 15 | $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; |
||
| 16 | if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { |
||
|
2 ignored issues
–
show
|
|||
| 17 | $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; |
||
| 18 | } |
||
| 19 | |||
| 20 | $time_string = sprintf( $time_string, |
||
| 21 | esc_attr( get_the_date( 'c' ) ), |
||
|
2 ignored issues
–
show
|
|||
| 22 | esc_html( get_the_date() ), |
||
|
1 ignored issue
–
show
|
|||
| 23 | esc_attr( get_the_modified_date( 'c' ) ), |
||
|
1 ignored issue
–
show
|
|||
| 24 | esc_html( get_the_modified_date() ) |
||
| 25 | ); |
||
| 26 | |||
| 27 | $posted_on = sprintf( |
||
| 28 | /* translators: %s: post date. */ |
||
| 29 | esc_html_x( 'Posted on %s', 'post date', '_s' ), |
||
|
1 ignored issue
–
show
|
|||
| 30 | '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>' |
||
|
2 ignored issues
–
show
|
|||
| 31 | ); |
||
| 32 | |||
| 33 | $byline = sprintf( |
||
| 34 | /* translators: %s: post author. */ |
||
| 35 | esc_html_x( 'by %s', 'post author', '_s' ), |
||
| 36 | '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>' |
||
|
3 ignored issues
–
show
|
|||
| 37 | ); |
||
| 38 | |||
| 39 | echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK. |
||
| 40 | |||
| 103 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.