Move feed link into template
All HTML should be in the templates whenever possible.
This commit is contained in:
@@ -1,16 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Add the RSS feed link in the <head> if there's posts
|
||||
*/
|
||||
function roots_feed_link() {
|
||||
$count = wp_count_posts('post'); if ($count->publish > 0) {
|
||||
echo "\n\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"". get_bloginfo('name') ." Feed\" href=\"". home_url() ."/feed/\">\n";
|
||||
}
|
||||
}
|
||||
|
||||
add_action('wp_head', 'roots_feed_link', -2);
|
||||
|
||||
/**
|
||||
* Add the asynchronous Google Analytics snippet from HTML5 Boilerplate
|
||||
* if an ID is defined in config.php
|
||||
|
||||
@@ -68,3 +68,8 @@ function is_element_empty($element) {
|
||||
$element = trim($element);
|
||||
return empty($element) ? false : true;
|
||||
}
|
||||
|
||||
function has_posts() {
|
||||
$count = wp_count_posts('post');
|
||||
return ($count->publish > 0) ? true : false;
|
||||
}
|
||||
|
||||
@@ -14,4 +14,8 @@
|
||||
<script>window.jQuery || document.write('<script src="<?php echo get_template_directory_uri(); ?>/assets/js/vendor/jquery-1.8.1.min.js"><\/script>')</script>
|
||||
|
||||
<?php wp_head(); ?>
|
||||
|
||||
<?php if (has_posts()): ?>
|
||||
<link rel="alternate" type="application/rss+xml" title="<?php echo get_bloginfo('name') ?> Feed" href="<?php echo home_url() ?>/feed/">
|
||||
<?php endif; ?>
|
||||
</head>
|
||||
Reference in New Issue
Block a user