Created
February 3, 2015 20:16
-
-
Save kalenjohnson/e365c43193936b4a4780 to your computer and use it in GitHub Desktop.
Sage Title with namespace
This file contains hidden or 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 | |
namespace Roots\Sage\Titles; | |
/** | |
* Page titles | |
*/ | |
function title() { | |
if (is_home()) { | |
if (get_option('page_for_posts', true)) { | |
return get_the_title(get_option('page_for_posts', true)); | |
} else { | |
return __('Latest Posts', 'sage'); | |
} | |
} elseif (is_archive()) { | |
return get_the_archive_title(); | |
} elseif (is_search()) { | |
return sprintf(__('Search Results for %s', 'sage'), get_search_query()); | |
} elseif (is_404()) { | |
return __('Not Found', 'sage'); | |
} else { | |
return get_the_title(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment