Added authorship rel attribute to post author link

This commit is contained in:
Scott Walkinshaw
2011-06-08 21:27:48 -06:00
parent 75d2738db9
commit acea241631
5 changed files with 12 additions and 6 deletions

View File

@@ -123,4 +123,10 @@ function roots_robots() {
echo "Allow: /assets";
}
function roots_author_link($link) {
return str_replace('<a ', '<a class="fn" rel="author"', $link);
}
add_filter('the_author_posts_link', 'roots_author_link');
?>

View File

@@ -103,6 +103,7 @@ add_filter('month_link', 'roots_root_relative_url');
add_filter('day_link', 'roots_root_relative_url');
add_filter('year_link', 'roots_root_relative_url');
add_filter('tag_link', 'roots_root_relative_url');
add_filter('the_author_posts_link', 'roots_root_relative_url');
// Leaving plugins_url alone in admin to avoid potential issues (such as Gravity Forms)
if (!is_admin()) {
@@ -357,7 +358,7 @@ class roots_nav_walker extends Walker_Nav_Menu {
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes = array_filter($classes, 'check_current');
$classes = array_filter($classes, 'roots_check_current');
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
@@ -382,9 +383,8 @@ class roots_nav_walker extends Walker_Nav_Menu {
}
}
function check_current($val) {
function roots_check_current($val) {
return preg_match('/current-menu/', $val);
}
?>

View File

@@ -14,7 +14,7 @@
<header>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<time pubdate datetime="<?php the_time('c'); ?>"><?php printf(__('Posted on %s at %s.', 'roots'), get_the_time('l, F jS, Y'), get_the_time()); ?></time>
<p class="byline author vcard"><?php _e('Written by', 'roots'); ?> <span class="fn"><?php the_author(); ?></span></p>
<p class="byline author vcard"><?php _e('Written by', 'roots'); ?> <?php the_author_posts_link(); ?></p>
</header>
<div class="entry-content">
<?php the_excerpt(); ?>

View File

@@ -7,7 +7,7 @@
<h1 class="entry-title"><?php the_title(); ?></h1>
<time class="updated" datetime="<?php the_time('c'); ?>" pubdate><?php printf(__('Posted on %s at %s.', 'roots'), get_the_time('l, F jS, Y'),get_the_time())?></time>
<p class="byline author vcard">
<?php _e('Written by', 'roots');?> <span class="fn"><?php the_author(); ?></span>
<?php _e('Written by', 'roots');?> <?php the_author_posts_link(); ?>
</p>
</header>
<div class="entry-content">

View File

@@ -14,7 +14,7 @@
<header>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<time pubdate datetime="<?php the_time('c'); ?>"><?php printf( __('Posted on %s at %s.','roots'), get_the_time('l, F jS, Y'), get_the_time()) ?></time>
<p class="byline author vcard"><span class="fn"><?php the_author(); ?></span></p>
<p class="byline author vcard"><?php the_author_posts_link(); ?></p>
</header>
<div class="entry-content">
<?php if (is_archive() || is_search()) : // Only display excerpts for archives and search ?>