Skip to content

Commit

Permalink
Merge pull request #1912 from kaisermann/title-on-controller
Browse files Browse the repository at this point in the history
Moved title() helper to app.php controller
  • Loading branch information
retlehs authored Aug 17, 2017
2 parents 6022309 + 0283131 commit e00eaf7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
24 changes: 0 additions & 24 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,27 +125,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();
}
20 changes: 20 additions & 0 deletions resources/controllers/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,24 @@ public function siteName()
{
return get_bloginfo('name');
}

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();
}
}
2 changes: 1 addition & 1 deletion resources/views/partials/page-header.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<div class="page-header">
<h1>{!! App\title() !!}</h1>
<h1>{!! App::title() !!}</h1>
</div>

0 comments on commit e00eaf7

Please sign in to comment.