Skip to content

Commit

Permalink
Add 'updated' rich snippet information. Fixes #29
Browse files Browse the repository at this point in the history
  • Loading branch information
obenland committed Oct 7, 2012
1 parent 77bb5f8 commit 23054de
Showing 1 changed file with 37 additions and 22 deletions.
59 changes: 37 additions & 22 deletions inc/template-tags.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php
/** template-tags.php
*
*
* Implementation of the Custom Header feature
* http://codex.wordpress.org/Custom_Headers
*
*
* @author Konstantin Obenland
* @package The Bootstrap
* @since 1.2.4 - 07.04.2012
Expand Down Expand Up @@ -33,16 +33,16 @@ function the_bootstrap_content_nav() {
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
$url_parts = explode( '?', $pagenum_link );

if ( isset( $url_parts[1] ) ) {
wp_parse_str( $url_parts[1], $query_args );
}
$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';

$format = ( $wp_rewrite->using_index_permalinks() AND ! strpos( $pagenum_link, 'index.php' ) ) ? 'index.php/' : '';
$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%';

$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
Expand Down Expand Up @@ -92,15 +92,30 @@ function the_bootstrap_comment_nav() {
* @return void
*/
function the_bootstrap_posted_on() {
printf( __( '<span class="sep">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a><span class="by-author"> <span class="sep"> by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'the-bootstrap' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'the-bootstrap' ), get_the_author() ) ),
get_the_author()

$time_string = ( get_the_time( 'U' ) == get_the_modified_time( 'U' ) )
? '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date published updated" datetime="%3$s" pubdate>%4$s</time></a>'
: '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date published" datetime="%3$s" pubdate>%4$s</time><time class="assistive-text updated" datetime="%5$s">%6$s</time></a>';

$time = sprintf(
$time_string . '<span class="by-author"> <span class="sep">',
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_attr( get_the_modified_date( 'c' ) ),
esc_html( get_the_modified_date() )
);

$author = sprintf(
'</span><span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'the-bootstrap' ), get_the_author() ) ),
get_the_author()
);

printf( __( 'Posted on %1$s by %2$s', 'the-bootstrap' ), $time, $author );

if ( comments_open() AND ! post_password_required() ) { ?>
<span class="sep"> | </span>
<span class="comments-link">
Expand Down Expand Up @@ -156,7 +171,7 @@ function the_bootstrap_link_pages( $args = array() ) {
if ($i == $page) {
$output .= '<li class="current"><span>' . $j . '</span></li>';
}

}
$output .= '</ul></nav>';
} else {
Expand Down Expand Up @@ -189,7 +204,7 @@ function the_bootstrap_link_pages( $args = array() ) {
*
* @author Konstantin Obenland
* @since 1.5,0 - 14.05.2012
*
*
* @param bool $echo Optional. Whether to echo the form
*
* @return void
Expand Down Expand Up @@ -222,10 +237,10 @@ function the_bootstrap_navbar_class() {

if ( 'static' != the_bootstrap_options()->navbar_position )
$classes[] = the_bootstrap_options()->navbar_position;

if ( the_bootstrap_options()->navbar_inverse )
$classes[] = 'navbar-inverse';

apply_filters( 'the_bootstrap_navbar_classes', $classes );

echo 'class="' . join( ' ', $classes ) . '"';
Expand All @@ -247,13 +262,13 @@ function the_bootstrap_navbar_class() {
* @param string $more The string to display when there are more than one comment
* @param string $css_class The CSS class to use for comments
* @param string $none The string to display when comments have been turned off
*
*
* @return void
*/
function the_bootstrap_comments_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
$number = get_comments_number();
$class = empty( $css_class ) ? '' : ' class="' . esc_attr( $css_class ) . '"';

if ( false === $zero ) $zero = __( 'No Comments' );
if ( false === $one ) $one = __( '1 Comment' );
if ( false === $more ) $more = __( '% Comments' );
Expand All @@ -268,20 +283,20 @@ function the_bootstrap_comments_link( $zero = false, $one = false, $more = false
echo '<span' . $class . '>' . __( 'Enter your password to view comments.' ) . '</span>';
return;
}

if ( 1 < $number )
$comments_number = str_replace( '%', number_format_i18n( $number ), $more );
else
$comments_number = ( 0 == $number ) ? $zero : $one;

$link = sprintf( '<a href="%1$s"%2$s%3s title="%4$s">%5$s</a>',
( 0 == $number ) ? '#respond' : '#comments',
$class,
apply_filters( 'comments_popup_link_attributes', '' ),
esc_attr( sprintf( __( 'Comment on %s' ), the_title_attribute( array('echo' => 0 ) ) ) ),
apply_filters( 'comments_number', $comments_number, $number )
);

echo apply_filters( 'the_bootstrap_comments_link', $link, $zero, $one, $more, $css_class, $none );
}
endif;
Expand Down

0 comments on commit 23054de

Please sign in to comment.