Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sage 10 Cleanup #2171

Merged
merged 5 commits into from
May 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,16 @@ During theme installation you will have options to update `style.css` theme head
```shell
themes/your-theme-name/ # → Root of your Sage based theme
├── app/ # → Theme PHP
│ ├── Controllers/ #Controller files
│ ├── Composers/ #Composer files
│ ├── admin.php # → Theme customizer setup
│ ├── filters.php # → Theme filters
│ ├── helpers.php # → Helper functions
│ └── setup.php # → Theme setup
├── config/ # → Config files
│ ├── app.php # → Application configuration
│ ├── assets.php # → Asset configuration
│ ├── filesystems.php # → Filesystems configuration
│ └── view.php # → View configuration
├── composer.json # → Autoloading for `app/` files
├── composer.lock # → Composer lock file (never edit)
├── dist/ # → Built theme assets (never edit)
Expand Down Expand Up @@ -97,7 +102,6 @@ Edit `app/setup.php` to enable or disable theme features, setup navigation menus
## Documentation

* [Sage documentation](https://roots.io/sage/docs/)
* [Controller documentation](https://github.com/soberwp/controller#usage)

## Contributing

Expand All @@ -107,7 +111,7 @@ Contributions are welcome from everyone. We have [contributing guidelines](https

Help support our open-source development efforts by [becoming a patron](https://www.patreon.com/rootsdev).

<a href="https://kinsta.com/?kaid=OFDHAJIXUDIV"><img src="https://cdn.roots.io/app/uploads/kinsta.svg" alt="Kinsta" width="200" height="150"></a> <a href="https://k-m.com/"><img src="https://cdn.roots.io/app/uploads/km-digital.svg" alt="KM Digital" width="200" height="150"></a>
<a href="https://kinsta.com/?kaid=OFDHAJIXUDIV"><img src="https://cdn.roots.io/app/uploads/kinsta.svg" alt="Kinsta" width="200" height="150"></a> <a href="https://k-m.com/"><img src="https://cdn.roots.io/app/uploads/km-digital.svg" alt="KM Digital" width="200" height="150"></a> <a href="https://www.itineris.co.uk/"><img src="https://cdn.roots.io/app/uploads/itineris.svg" alt="itineris" width="200" height="150"></a>

## Community

Expand Down
24 changes: 24 additions & 0 deletions app/Composers/Title.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,61 @@

class Title extends Composer
{
/**
* List of views served by this composer.
*
* @var array
*/
protected static $views = [
'partials.page-header',
'partials.content',
'partials.content-*'
];

/**
* Data to be passed to view before rendering.
*
* @param array $data
* @param \Illuminate\View\View $view
* @return array
*/
public function with($data, $view)
{
return ['title' => $this->title($view->getName())];
}

/**
* Returns the post title.
*
* @param \Illuminate\View\View $view
* @return string
*/
public function title($view)
{
if ($view !== 'partials.page-header') {
return get_the_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: 0 additions & 2 deletions app/helpers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<?php

namespace App;


2 changes: 2 additions & 0 deletions app/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@
'before_title' => '<h3>',
'after_title' => '</h3>'
];

register_sidebar([
'name' => __('Primary', 'sage'),
'id' => 'sidebar-primary'
] + $config);

register_sidebar([
'name' => __('Footer', 'sage'),
'id' => 'sidebar-footer'
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@
"App\\": "app/"
}
},
"repositories": [
{
"type": "git",
"url": "https://github.com/qwp6t/acorn"
}
],
"minimum-stability": "dev",
"require": {
"php": ">=7.1",
"php": "^7.1.3",
"roots/acorn": "dev-master"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.3",
"roots/sage-installer": "~1.3"
"roots/sage-installer": "^1.6",
"squizlabs/php_codesniffer": "^3.3"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"test": [
"phpcs"
Expand Down
Loading