Created
December 28, 2011 14:01
-
-
Save mgiulio/1528031 to your computer and use it in GitHub Desktop.
functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('template_redirect', 'on_template_redirect'); | |
function on_template_redirect() { | |
if (!is_home()) | |
return; | |
wp_enqueue_script( | |
'post-date', | |
'/wp-content/themes/twentyeleven-child/js/post-date.js', | |
array('jquery'), | |
'', | |
true); | |
} | |
function twentyeleven_posted_on() { | |
if (is_home()) | |
printf(__( | |
'<time datetime="%1$s" pubdate title="%2$s">' . | |
'<span class="month">%3$s</span>' . | |
'<span class="day">%4$s</span>' . | |
'</time>', 'twentyeleven'), | |
esc_attr(get_the_date('c')), | |
esc_attr(get_the_date('r')), | |
esc_html(strtolower(get_the_date('M'))), | |
esc_html(get_the_date('d')) | |
); | |
else { | |
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>', 'twentyeleven' ), | |
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', 'twentyeleven' ), get_the_author() ) ), | |
get_the_author() | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment