Added authorship rel attribute to post author link
This commit is contained in:
@@ -123,4 +123,10 @@ function roots_robots() {
|
|||||||
echo "Allow: /assets";
|
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');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ add_filter('month_link', 'roots_root_relative_url');
|
|||||||
add_filter('day_link', 'roots_root_relative_url');
|
add_filter('day_link', 'roots_root_relative_url');
|
||||||
add_filter('year_link', 'roots_root_relative_url');
|
add_filter('year_link', 'roots_root_relative_url');
|
||||||
add_filter('tag_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)
|
// Leaving plugins_url alone in admin to avoid potential issues (such as Gravity Forms)
|
||||||
if (!is_admin()) {
|
if (!is_admin()) {
|
||||||
@@ -357,7 +358,7 @@ class roots_nav_walker extends Walker_Nav_Menu {
|
|||||||
$class_names = $value = '';
|
$class_names = $value = '';
|
||||||
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
|
$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 = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );
|
||||||
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
|
$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);
|
return preg_match('/current-menu/', $val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
|
<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>
|
<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>
|
</header>
|
||||||
<div class="entry-content">
|
<div class="entry-content">
|
||||||
<?php the_excerpt(); ?>
|
<?php the_excerpt(); ?>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<h1 class="entry-title"><?php the_title(); ?></h1>
|
<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>
|
<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">
|
<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>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
<div class="entry-content">
|
<div class="entry-content">
|
||||||
|
|||||||
2
loop.php
2
loop.php
@@ -14,7 +14,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
|
<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>
|
<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>
|
</header>
|
||||||
<div class="entry-content">
|
<div class="entry-content">
|
||||||
<?php if (is_archive() || is_search()) : // Only display excerpts for archives and search ?>
|
<?php if (is_archive() || is_search()) : // Only display excerpts for archives and search ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user