Moved title() helper to app.php controller
This commit is contained in:
@@ -87,27 +87,3 @@ function display_sidebar()
|
||||
isset($display) || $display = apply_filters('sage/display_sidebar', false);
|
||||
return $display;
|
||||
}
|
||||
|
||||
/**
|
||||
* Page titles
|
||||
* @return string
|
||||
*/
|
||||
function title()
|
||||
{
|
||||
if (is_home()) {
|
||||
if ($home = get_option('page_for_posts', true)) {
|
||||
return get_the_title($home);
|
||||
}
|
||||
return __('Latest Posts', 'sage');
|
||||
}
|
||||
if (is_archive()) {
|
||||
return get_the_archive_title();
|
||||
}
|
||||
if (is_search()) {
|
||||
return sprintf(__('Search Results for %s', 'sage'), get_search_query());
|
||||
}
|
||||
if (is_404()) {
|
||||
return __('Not Found', 'sage');
|
||||
}
|
||||
return get_the_title();
|
||||
}
|
||||
|
||||
@@ -10,4 +10,28 @@ class App extends Controller
|
||||
{
|
||||
return get_bloginfo('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Page titles
|
||||
* @return string
|
||||
*/
|
||||
public static function title()
|
||||
{
|
||||
if (is_home()) {
|
||||
if ($home = get_option('page_for_posts', true)) {
|
||||
return get_the_title($home);
|
||||
}
|
||||
return __('Latest Posts', 'sage');
|
||||
}
|
||||
if (is_archive()) {
|
||||
return get_the_archive_title();
|
||||
}
|
||||
if (is_search()) {
|
||||
return sprintf(__('Search Results for %s', 'sage'), get_search_query());
|
||||
}
|
||||
if (is_404()) {
|
||||
return __('Not Found', 'sage');
|
||||
}
|
||||
return get_the_title();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<div class="page-header">
|
||||
<h1>{!! App\title() !!}</h1>
|
||||
<h1>{!! App::title() !!}</h1>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user