Add code comments

This commit is contained in:
Ben Word
2012-07-17 19:23:35 -05:00
parent 953c3ba4b3
commit 25982f12b3

View File

@@ -1,5 +1,8 @@
<?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";
@@ -8,11 +11,16 @@ function roots_feed_link() {
add_action('roots_head', 'roots_feed_link');
/**
* Add the asynchronous Google Analytics snippet from HTML5 Boilerplate
* if an ID is defined in config.php
*
* @link mathiasbynens.be/notes/async-analytics-snippet
*/
function roots_google_analytics() {
$roots_google_analytics_id = GOOGLE_ANALYTICS_ID;
if ($roots_google_analytics_id !== '') {
if (GOOGLE_ANALYTICS_ID) {
echo "\n\t<script>\n";
echo "\t\tvar _gaq=[['_setAccount','$roots_google_analytics_id'],['_trackPageview']];\n";
echo "\t\tvar _gaq=[['_setAccount','" . GOOGLE_ANALYTICS_ID . "''],['_trackPageview']];\n";
echo "\t\t(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];\n";
echo "\t\tg.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';\n";
echo "\t\ts.parentNode.insertBefore(g,s)}(document,'script'));\n";