noisy/inc/template-tags.php

41 lines
1.1 KiB
PHP

<?php
/********
* TODO *
********/
/**
* Custom template tags for this theme
*
* Eventually, some of the functionality here could be replaced by core features.
*
* @package noisy
*/
if ( ! function_exists( 'noisy_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time.
*/
function noisy_posted_on() {
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>, letztes Update <time class="updated" datetime="%3$s">%4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( DATE_W3C ) ),
esc_html( get_the_date('c') ),
esc_attr( get_the_modified_date( DATE_W3C ) ),
esc_html( get_the_modified_date('c') )
);
$posted_on = sprintf(
/* translators: %s: post date. */
esc_html_x( 'Erschienen am %s', 'post date', 'noisy' ),
$time_string
);
echo '<span class="meta">' . $posted_on . '</span>'; // WPCS: XSS OK.
}
endif;