Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fdb9a52
New Project cleanup, utility nav
Apr 27, 2024
85986c9
.
May 3, 2024
0ea7291
Merge pull request #82 from adampatterson/wip
adampatterson May 3, 2024
0741411
Sass cleanup
May 30, 2024
f50711c
Adds aspect and SVG upload
May 30, 2024
ec95e96
changed get_acf_part to get_template_part_acf
adampatterson Jun 8, 2024
5c266a7
Adds WP_DEBUG to admin helper
adampatterson Jun 8, 2024
a18d359
Doc cleanup, a rough Project Setup
adampatterson Jun 8, 2024
b377a3a
Removed content-{slug} from is_sub_page
adampatterson Jun 9, 2024
6170b3c
Template cleanup
Jul 2, 2024
c53731b
Merge branch 'dev' of github.com:adampatterson/Axe into dev
Jul 2, 2024
a476cc4
Adds how to use aspect
adampatterson Jul 10, 2024
efbe9eb
Adds makeSrcSet
adampatterson Jul 10, 2024
978c9e2
Documentation update
Nov 30, 2024
9f2f889
Merge branch 'dev' of github.com:adampatterson/Axe into dev
Dec 23, 2024
cc9652c
Adds composer theme install
adampatterson Dec 30, 2024
1561aaa
Merge branch 'staging' into dev
Dec 30, 2024
6048a7a
Adds minimum stability
Dec 30, 2024
f13eda7
Merge branch 'main' into staging
Dec 30, 2024
05e6486
Merge branch 'staging' into dev
Dec 30, 2024
1f337eb
.
Dec 30, 2024
5a8795f
Modernizes TheLoop
May 1, 2025
43506d5
Updates NPM Packages
Dec 16, 2025
6e415d0
Fixes _load_textdomain_just_in_time
adampatterson Mar 16, 2026
e7e93de
Replaces post_categories with meta_terms
adampatterson Mar 16, 2026
12c4c97
Updated Git Ignore
adampatterson Mar 16, 2026
33ca4ca
Scss cleanup
adampatterson Mar 16, 2026
39f6ad0
adds gap-2 to categories
adampatterson Mar 16, 2026
8214664
Updated docs
adampatterson Mar 16, 2026
99dee21
Moves template exception to Axe Helpers
adampatterson Mar 17, 2026
41905a7
Replaced array() with []
adampatterson Mar 17, 2026
d40d66d
Fixed $separator, adds array shape to $taxonomies
adampatterson Mar 17, 2026
e1c1ce3
Ignores composer auth.json
adampatterson Mar 17, 2026
f5cd14b
Fixed dev tag, Adds Spatie Ray for debugging
adampatterson Mar 17, 2026
fb1e579
Updates repo links
adampatterson Mar 17, 2026
f0c4920
Cleanup
adampatterson Mar 17, 2026
a7b6f1b
Switches from post_tags to meta_terms
adampatterson Mar 17, 2026
780438d
Initial GitHub actions
adampatterson Mar 17, 2026
7e21fc6
Bumped package lock
adampatterson Mar 17, 2026
1a5b389
Ignores docs folder for now.
adampatterson Mar 17, 2026
450190a
Ignores rector.php
adampatterson Mar 17, 2026
fe8ae37
Removes Spatie Ray
adampatterson Mar 17, 2026
9846712
… and the lock file
adampatterson Mar 17, 2026
4fb4e47
Fixes double action trigger
adampatterson Mar 17, 2026
9911a67
Using root .github workflows
adampatterson Mar 17, 2026
4b43208
Require PHP 8.2 OR 8.4
adampatterson Mar 17, 2026
b3db5b1
Adds custom npm build commnad
adampatterson Mar 17, 2026
209d81d
Package cleanup, flipped build command
adampatterson Mar 17, 2026
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
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "composer"
# Look for a `Dockerfile` in the `root` directory
directory: "/"
# Check for updates once a week
schedule:
interval: "weekly"
21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# .github/workflows/build.yml
name: Build Theme Assets

on:
push:
branches: [ main, staging, dev ]
pull_request:
branches: [ main, staging ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-shared-build:
uses: adampatterson/.github/.github/workflows/wordpress-theme-build.yml@main
with:
# You can override versions here or just omit these lines to use the defaults
php-versions: '["8.2", "8.4"]'
node-versions: '["22", "24"]'
build-command: 'npm run prod'
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ node_modules
/src/vendor
/node_modules
/assets/vendor
/yarn.lock
/package-lock.json
/mix-manifest.json
/assets/js/manifest.js
*.map
Expand All @@ -19,3 +17,9 @@ node_modules
/Axe-Helpers
/acf-json
.env
.design
.src
wp-cli.yml
auth.json
/docs
/rector.php
162 changes: 124 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Axe is a simple bare-bones WordPress starter theme and structure. It is a theme
fast as possible.

My build workflow might not be very orthodox, but I typically review the design, Set up my Custom post types
using [Custom Post Type UI](https://en-ca.wordpress.org/plugins/custom-post-type-ui/) and setup any page data structures
using [ACF](http://www.advancedcustomfields.com/).
using [Custom Post Type UI](https://en-ca.wordpress.org/plugins/custom-post-type-ui/) and setup any page data structures using [ACF](http://www.advancedcustomfields.com/).

Simply being able to plow ahead creating my site structures and loading in real or fake content lets me have something
tangible to work with.
Expand All @@ -17,7 +16,7 @@ to the admin pages.
/*
* Load this in your footer, and
* check to see if the user is logged in.
* /
*/
<? $data = get_fields();?>
<script>
console.log(<?= json_encode($data) ?>)
Expand Down Expand Up @@ -73,11 +72,9 @@ npm i && php composer i && npm run prod

A `package.json` file with Bootstrap and jQuery is included.

The [src folder](https://github.com/adampatterson/Axe/tree/master/src) stores your SCSS and JS that will be compiled
into `/assets` using Laravel Mix.
The [src folder](https://github.com/adampatterson/Axe/tree/master/src) stores your SCSS and JS that will be compiled into `/assets` using Laravel Mix.

If you are looking for a more advanced Mix configuration, then have a look at
the [official docs](https://laravel-mix.com/docs/6.0/installation).
If you are looking for a more advanced Mix configuration, then have a look at the [official docs](https://laravel-mix.com/docs/6.0/installation).

**Mix Installation & Setup**
https://laravel.com/docs/master/mix#installation
Expand All @@ -104,11 +101,15 @@ the ability to load assets from both the Child and Parent theme. Omitting usePar

### Child Themes

https://github.com/adampatterson/Handle
- Parent
- Axe
- Child
- [Handle](https://github.com/adampatterson/handle) | Bootstrap + Webpack
- [Edge](https://github.com/adampatterson/edge) | Tailwind + Vite
- [Blade](https://github.com/adampatterson/blade) | Work In Progress - Bootstrap / Demo

If you will be using ACF with your child theme uncomment
the [following](https://github.com/adampatterson/Handle/blob/master/lib/Custom.php#L12) so that ACF will store
the `.json` files in your working Child theme.
If you are using ACF with your child theme uncomment the [following](https://github.com/adampatterson/handle/blob/main/lib/Custom.php#L12) so that ACF will store the
`.json` files in your working Child theme.

---

Expand Down Expand Up @@ -226,14 +227,14 @@ Accessing `/` will resolve the home page and look for the file `templates/conten

- The custom post type archive `{type}` will load `templates/archive-{type}.php`
- The default archive would be `archive-default.php` using the default post loop.
- Accessing `/books/sci-fi/` can user a custom loop `get_acf_part('templates/loop', 'books');`
- Accessing `/books/sci-fi/` can use a custom loop `get_acf_part('templates/loop', 'books');`

### Custom Loops

If you have a custom post type called Books, creating `content-books.php` and loading a custom loop
like `loop-books.php` with all the necessary "Loop" code would give you a custom book loop.

See [loop-post.php](https://github.com/adampatterson/Axe/blob/master/templates/loop-post.php) for an example.
See [loop-post.php](https://github.com/adampatterson/axe/blob/main/templates/loop-post.php) for an example.

## Helper Functions

Expand All @@ -252,22 +253,49 @@ _Functions in the parent theme should be wrapped with `function_exists` any conf
---

`get_template_part_acf()` - Works like `get_template_part()` except that it returns a path for you to `include`. This
makes it more suitable to use with ACF. You can include your custom content once which is already done for you.
makes it more suitable to use with ACF. You can include your custom content once which is already done for you
thought `include(__THEME_DATA__.'/lib/data.php');`.

```php
include(get_template_part_acf('templates/content', 'blog'));
$yourData = [];
include(get_template_part_acf('templates/partials/header'));
```

Inside **header.php** you can now access `$yourData`.

**Alternatively**

`get_acf_part()` internally calls `get_template_part_acf()` but does the include for you, this helps keep your code nice
YOu can use `get_acf_part()` which internally calls `get_template_part_acf()` but does the include for you, this helps
keep your code nice
and clean.

If you wish to pass data through to your template part, you can pass it through the `data` property where it will now be
accessible through `$data`.

```php
// Standard usage, external data is not available inside
get_acf_part('templates/content', 'blog');
```

```php
// Passing data to get_acf_part
$yourData = [];
get_acf_part('templates/content', 'home', data: $yourData);
```

Inside **content-home.php** you can now access `$data`.

**When to use `get_acf_part` and `get_template_part_acf`**

I like to use `get_template_part_acf` inside of the root WordPress template files like index, page, single, and archive.

Theis lets me declare my ACF or any other data once at a high level allowing it to take advantage of
PHPs [variable scope](https://www.php.net/manual/en/language.variables.scope.php).

`get_acf_part` is then used when I want more control over what's being passed to the partial. `get_acf_part` is closer
to the core functionality and implementation of `get_template_part` but does not require you to pass through data in an
`args` array.

See [data](#data) for more information on `$data` and `$blocks`.

```php
Expand Down Expand Up @@ -391,9 +419,21 @@ Have a look at some of the ACF fields, blocks, and a template [here](example).
`_get()` - alias for `Arr::get($haystack, $needle, $default = false)`

```php
$block = [
// the title key is not set
];

<?= _get($block, 'title', 'Default Title') ?>
```

```php
$block = [
'title' => ''
];

<?= _get($block, 'title', 'Default Title', defaultIfEmpty: true) ?>
```

```php
foreach (_get($block, 'block.items', []) as $item):
...
Expand All @@ -403,7 +443,13 @@ endforeach;
`_has()` - alias for `Arr::has($haystack, $needle)`

```php
if (_has($block, 'contact.phone', false)): ?>
$block = [
'contact' => [
'phone' => ''
// or the array key is missing
]
];
if (_has($block, 'contact.phone', default: false)): ?>
...
endif;
```
Expand All @@ -428,23 +474,21 @@ endif;
## Style

```scss
@import "components/base-variables";
@import "global/overrides";
@import "~bootstrap/scss/bootstrap";
```

With the addition of PurgeCSS to the build script you can safely include the entire Bootstrap library. Once a production
build has been done, any unused CSS classes will be removed.

`base-variables` holds any site specific variables that you might need including any
Bootstrap [customizations](https://getbootstrap.com/docs/5.1/customize/sass/)
`global/overrides/index.scss` holds any **site-specific** variables that you might need to modify including any
Bootstrap [customizations](https://getbootstrap.com/docs/5.3/customize/sass/)

# Child theme

https://github.com/adampatterson/Handle

Opening `/lib/Helpers.php` and uncommenting the function
on [line 6](https://github.com/adampatterson/Handle/blob/master/lib/Helpers.php#L6) would allow the child theme to serve
all of your themes assets.
Opening `/lib/Helpers.php` and uncommenting the function `__t()` will serve all of your theme assets from the child theme.

## Recommended Plugins

Expand All @@ -457,14 +501,16 @@ all of your themes assets.

## To-Do's

- Create a model for ACF and other data sources
- Document a lot of the inner code such as helpers
- Document included packages
- Document the build process
- Document Child theme process using ( Handle )
- Build out a demo theme ( Blade )
- Update to Bootstrap 5
- Fix WebPack PurgeCSS
- [ ] Create a model for ACF and other data sources
- [ ] Document a lot of the inner code such as helpers
- [ ] Document included packages
- [ ] Document the build process
- [ ] Theme configuration
- [ ] Document Child theme process using ([Handle](https://github.com/adampatterson/handle))
- [ ] Modernized Tailwind + Vite theme ([Edge](https://github.com/adampatterson/edge))
- [ ] Build out a demo theme ([Blade](https://github.com/adampatterson/blade))
- [ ] Fix WebPack PurgeCSS
- [x] Update to Bootstrap 5.3

## Dummy Content for Gutenberg

Expand All @@ -480,16 +526,56 @@ by [Alecaddd](https://github.com/Alecaddd/awps)

### Contributors:

Adam
Patterson ( [@adampatterson](http://twitter.com/adampatterson) / [adampatterson.ca](https://www.adampatterson.ca/) )
Adam Patterson -[@adampatterson](http://twitter.com/adampatterson) / [adampatterson.ca](https://www.adampatterson.ca/)

### Disclaimer

This theme reflects my own workflows and process, I have built over 100 sites using these setup and it has evolved over
time. With that said, If you have anything to add please email me at hello@adampatterson.ca
This theme evolves over time as my own workflows and process change, I have built over 100 sites using this setup. With that said, If you have anything to add please email me at hello@adampatterson.ca

### Project Setup

```shell
mkdir project-name.test
cd project-name.test
git checkout git@github.com:adampatterson/project-name.git .
wp core download
wp core config --dbname=database_name --dbuser=root --dbpass=secret --dbhost=localhost --dbprefix=wp_
wp core install --url=project-name.test --title="Your Site" --admin_user=username --admin_password=top-secret-password --admin_email=email@domain.com
```

_Note the space at the start of the commands. This will prevent the command from logging in your `history`._

In the site root run `cp .env.example .env` and then add the proper config values.

If there are `wp-config.php` constants that you need to set but are not included,
then add them to the `.env` and modify your `wp-config.php` file.

your `wp-config.php` **SHOULD** be in version control.

**From the site root:**

```shell
composer i
```

**From the theme root:**

```shell
cd wp-content/themes/name
npm i && php composer i && npm run prod
```

#### Local Development

ln -s ~/Sites/cms/wordpress/wp-content/themes/Blade ./
ln -s ~/Sites/cms/wordpress/wp-content/themes/Axe ./
ln -s ~/Sites/cms/wordpress/wp-content/themes/Axe-Helpers ./Axe/vendor/adampatterson
```shell
ln -s ~Sites/personal/_wordpress/Blade ./
ln -s ~Sites/personal/_wordpress/Handle ./
ln -s ~Sites/personal/_wordpress/Edge ./
ln -s ~/Sites/personal/_wordpress/Axe ./
```

Run `composer install` from within the `Axe` theme.

```shell
ln -s ~/Sites/personal/_packages/Axe-Helpers ./Axe/vendor/adampatterson
```
18 changes: 9 additions & 9 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
/*
* All globally availbile ACF data is loaded here.
*/
include(__THEME_DATA__ . '/lib/data.php');
include(__THEME_DATA__.'/lib/data.php');

get_acf_part('templates/partials/header');
include get_template_part_acf('templates/partials/header');

echo '<!-- main/archive -->';

Expand All @@ -17,21 +17,21 @@
$post_type_slug = ($post_type !== 'post') ? $post_type_data->rewrite['slug'] : '';
}

if (check_path('/templates/archive-' . $post_type_slug . '.php')):
echo '<!-- template: index/archive-' . $post_type_slug . ' -->';
get_acf_part('templates/archive', $post_type_slug);
if (check_path('/templates/archive-'.$post_type_slug.'.php')):
echo '<!-- template: index/archive-'.$post_type_slug.' -->';
include get_template_part_acf('templates/archive', $post_type_slug);
elseif (is_author()):
echo '<!-- template: templates/archive-author -->';
get_acf_part('templates/archive', 'author');
include get_template_part_acf('templates/archive', 'author');
else:
echo '<!-- template: index/archive -->';
get_acf_part('templates/archive', 'default');
include get_template_part_acf('templates/archive', 'default');
endif;
endif;

else:
echo '<!-- template: index/no_posts -->';
get_acf_part('templates/archive', 'default');
include get_template_part_acf('templates/archive', 'default');
endif;

get_acf_part('templates/partials/footer');
include get_template_part_acf('templates/partials/footer');
Loading
Loading