├── .editorconfig
├── composer.json
├── CONTRIBUTING.md
├── LICENSE.md
├── ruleset.xml
├── README.md
├── sagextras.php
└── modules
├── gallery.php
└── nav-walker.php
/.editorconfig:
--------------------------------------------------------------------------------
1 | # editorconfig.org
2 |
3 | root = true
4 |
5 | [*]
6 | indent_style = space
7 | indent_size = 2
8 | end_of_line = lf
9 | charset = utf-8
10 | trim_trailing_whitespace = true
11 | insert_final_newline = true
12 |
13 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "storm2k/sagextras",
3 | "type": "wordpress-plugin",
4 | "license": "MIT",
5 | "description": "A WordPress plugin to restore some Bootstrap specific functionality to the Sage theme.",
6 | "homepage": "https://github.com/storm2k/sagextras",
7 | "authors": [
8 | {
9 | "name": "Michael Romero",
10 | "email": "romero@dimensionsixdesign.com",
11 | "homepage": "https://github.com/storm2k"
12 | }
13 | ],
14 | "keywords": [
15 | "wordpress",
16 | "sage"
17 | ],
18 | "support": {
19 | "issues": "https://github.com/storm2k/sagextras/issues"
20 | },
21 | "require": {
22 | "php": ">=5.4.0",
23 | "composer/installers": "~1.0"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | I welcome all contributions to this plugin that will help make it better and more useful for everyone who uses it. Please follow a couple of guidelines when coding as outlined below.
4 |
5 | ## Coding Standards
6 |
7 | For convenience coding standard rules, compatible with Roots guidelines are provided, along with proper .editorconfig file.
8 |
9 | You can check if your contribution passes the styleguide by installing [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) and running the following in your project directory:
10 |
11 | ```bash
12 | phpcs --standard=ruleset.xml --extensions=php -n -s .
13 | ```
14 |
15 | ## Additonal code rules
16 |
17 | * Use `Sagextras\` namespace
18 | * Use short array syntax
19 | * Use short echo syntax
20 |
21 | ## Pull Requests
22 |
23 | Please make sure your pull requests contain a clear decription of the changes you've made before submitting. Thanks!
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | Copyright (c) Michael Romero
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of
4 | this software and associated documentation files (the "Software"), to deal in
5 | the Software without restriction, including without limitation the rights to
6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 | of the Software, and to permit persons to whom the Software is furnished to do
8 | so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | SOFTWARE.
20 |
--------------------------------------------------------------------------------
/ruleset.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 | `add_theme_support('se-nav-walker');`
9 |
10 | **REMINDER!!!** You need to go into `templates/header.php` and replace the menu code with the code contained in [this Gist](https://gist.github.com/johnny-bit/cc8840f148da01c2af52) so the menu works properly.
11 |
12 | ~~ * **Bootstrap friendly Gallery code**
13 | `add_theme_support('se-gallery');`~~
14 | **Please Note:** With the release of Sage 8.3.0, this doesn't work anymore because Sage now uses WordPress's standard HTML5 gallery codes.
15 |
16 | ## Support
17 |
18 | Please feel free to open an [issue](https://github.com/storm2k/sagextras/issues) if you run into problems.
19 |
20 | ## Contributions
21 |
22 | I welcome all ideas and support on how to make this better for everyone. [Pull requests](https://github.com/storm2k/sagextras/pulls) are more than welcome. Please take a look at the [contributing](https://github.com/storm2k/sagextras/blob/master/CONTRIBUTING.md) file for coding standards and some testing.
23 |
24 | (A big thanks to everyone who has contributed thusfar, especially [johnny-bit](https://github.com/johnny-bit), who has done a lot of work cleaning up the code and bringing it up to par for standards!)
25 |
26 | ## ToDo
27 |
28 | - NavWalker uses code from Sage release 8.1.1. Looking forward to modularizing utils it uses.
29 | - Gallery is now namespaced, looking forward to modularizing any utils it uses.
30 |
31 |
--------------------------------------------------------------------------------
/sagextras.php:
--------------------------------------------------------------------------------
1 | options;
39 | }
40 | if (substr($module, 0, 5) !== 'se-') {
41 | return self::get('se-' . $module);
42 | }
43 | return [];
44 | }
45 |
46 | protected function __construct($options) {
47 | $this->set($options);
48 | }
49 |
50 | public function set($options) {
51 | $this->options = $options;
52 | }
53 | }
54 |
55 | function load_modules() {
56 | global $_wp_theme_features;
57 | foreach (glob(__DIR__ . '/modules/*.php') as $file) {
58 | $feature = 'se-' . basename($file, '.php');
59 | $soil_feature = 'soil-' . basename($file, '.php');
60 | if (isset($_wp_theme_features[$feature])) {
61 |
62 | if (isset($_wp_theme_features[$soil_feature])) {
63 | unset($_wp_theme_features[$soil_feature]);
64 | }
65 |
66 | Options::init($feature, $_wp_theme_features[$feature]);
67 | require_once $file;
68 | }
69 | }
70 | }
71 |
72 | add_action('after_setup_theme', __NAMESPACE__ . '\\load_modules', 100);
73 |
--------------------------------------------------------------------------------
/modules/gallery.php:
--------------------------------------------------------------------------------
1 | 'ASC',
41 | 'orderby' => 'menu_order ID',
42 | 'id' => $post->ID,
43 | 'itemtag' => '',
44 | 'icontag' => '',
45 | 'captiontag' => '',
46 | 'columns' => 4,
47 | 'size' => 'thumbnail',
48 | 'include' => '',
49 | 'exclude' => '',
50 | 'link' => ''
51 | ], $attr));
52 |
53 | $id = intval($id);
54 | $columns = (12 % $columns == 0) ? $columns : 4;
55 | $grid = sprintf('col-sm-%1$s col-lg-%1$s', 12 / $columns);
56 |
57 | if ($order === 'RAND') {
58 | $orderby = 'none';
59 | }
60 |
61 | if (!empty($include)) {
62 | $_attachments = get_posts(['include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby]);
63 |
64 | $attachments = [];
65 | foreach ($_attachments as $key => $val) {
66 | $attachments[$val->ID] = $_attachments[$key];
67 | }
68 | } elseif (!empty($exclude)) {
69 | $attachments = get_children(['post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby]);
70 | } else {
71 | $attachments = get_children(['post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby]);
72 | }
73 |
74 | if (empty($attachments)) {
75 | return '';
76 | }
77 |
78 | if (is_feed()) {
79 | $output = "\n";
80 | foreach ($attachments as $att_id => $attachment) {
81 | $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
82 | }
83 | return $output;
84 | }
85 |
86 | $unique = (get_query_var('page')) ? $instance . '-p' . get_query_var('page') : $instance;
87 | $output = '