Skip to content
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
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
REMOTE: "macrosbysara.com" # Remote folder to deploy to
theme_name: "macros-by-sara"
flags: "-azr --delete"
with_autoload: true
secrets: inherit

deploy-stg:
Expand All @@ -26,4 +27,5 @@ jobs:
REMOTE: staging6.macrosbysara.com
theme_name: "macros-by-sara"
flags: "-azvr --delete"
with_autoload: true
secrets: inherit
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
"alignfull",
"alignwide",
"atts",
"autoloading",
"azvr",
"bloginfo",
"choctawnationofoklahoma",
"classmap",
"cpts",
"Linktree",
"macrosbysara",
Expand Down Expand Up @@ -70,6 +72,6 @@
"html.format.templating": true,
"phpSniffer.standard": "phpcs.xml.dist",
"scss.format.spaceAroundSelectorSeparator": true,
"stylelint.snippet": [ "css", "scss" ],
"stylelint.validate": [ "css", "scss" ]
"stylelint.snippet": ["css", "scss"],
"stylelint.validate": ["css", "scss"]
}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 3.0.0 - [April 11, 2026]

- Breaking: Swap to autoloading classes
- Added: PMPro handler

## 2.2.0 - [March 28, 2026]

- Added: New Consistency Club Post Type & Taxonomies
Expand Down
5 changes: 5 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"name": "macros-by-sara/wordpress-theme",
"description": "a custom wordpress theme",
"type": "project",
"autoload": {
"classmap": [
"inc/"
]
},
"repositories": [
{
"type": "composer",
Expand Down
12 changes: 9 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
* @package MacrosBySara
*/

use MacrosBySara\Theme_Init;
use MacrosBySara\Theme\Theme_Init;

require_once get_stylesheet_directory() . '/inc/theme/class-theme-init.php';
new Theme_Init();
$autoloader = get_stylesheet_directory() . '/vendor/autoload.php';
if ( file_exists( $autoloader ) ) {
require_once $autoloader;
} else {
wp_die( 'Autoloader not found. Please run composer install.' );
}
$theme = new Theme_Init();
add_action( 'after_setup_theme', array( $theme, 'bootstrap_theme' ) );
4 changes: 2 additions & 2 deletions inc/plugins/acf/class-acf-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @package MacrosBySara
*/

namespace MacrosBySara;
namespace MacrosBySara\Plugins;

/**
* ACF_Handler Class
Expand Down Expand Up @@ -82,4 +82,4 @@ public function load_json_paths( array $paths ): array {
$paths = array_map( fn( $dir ) => $this->base_path . $dir, array_values( $this->paths_array ) );
return $paths;
}
}
}
4 changes: 2 additions & 2 deletions inc/theme/class-gutenberg-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @package MacrosBySara
*/

namespace MacrosBySara;
namespace MacrosBySara\Theme;

/**
* Gutenberg Handler
Expand Down Expand Up @@ -80,4 +80,4 @@ public function register_theme_blocks() {
$blocks_path = get_template_directory() . '/build';
wp_register_block_types_from_metadata_collection( $blocks_path . '/js/blocks', $blocks_path . '/blocks-manifest.php' );
}
}
}
2 changes: 1 addition & 1 deletion inc/theme/class-rest-router.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package MacrosBySara
*/

namespace MacrosBySara;
namespace MacrosBySara\Theme;

use WP_REST_Controller;
use WP_REST_Request;
Expand Down
23 changes: 6 additions & 17 deletions inc/theme/class-theme-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,18 @@
* @package MacrosBySara
*/

namespace MacrosBySara;
namespace MacrosBySara\Theme;

/**
* Class: Theme Init
*/
class Theme_Init {
/**
* Utils Loader
*
* @var Utils_Loader $loader
* Bootstrap the theme by setting up supports and disabling comments.
*/
private Utils_Loader $loader;

/**
* Constructor
*/
public function __construct() {
require_once get_stylesheet_directory() . '/inc/theme/class-utils-loader.php';
$this->loader = new Utils_Loader();
$this->loader->load_files();
public function bootstrap_theme() {
$this->disable_discussion();
add_action( 'after_setup_theme', array( $this, 'configure_theme_support' ) );
$this->configure_theme_support();
add_action( 'init', array( $this, 'alter_post_types' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
add_filter( 'wp_speculation_rules_configuration', array( $this, 'handle_speculative_loading' ) );
Expand Down Expand Up @@ -91,7 +81,6 @@ public function alter_post_types() {
);
}


/**
* Enqueue scripts and styles.
*/
Expand All @@ -107,7 +96,7 @@ public function enqueue_scripts(): void {
),
);
foreach ( $files as $handle => $paths ) {
$assets = require_once get_stylesheet_directory() . "/build/{$paths['js']}.asset.php";
$assets = require get_stylesheet_directory() . "/build/{$paths['js']}.asset.php";

$deps = $assets['dependencies'];
if ( 'bootstrap' !== $handle ) {
Expand Down Expand Up @@ -143,4 +132,4 @@ public function handle_speculative_loading( $config ) {
}
return $config;
}
}
}
80 changes: 0 additions & 80 deletions inc/theme/class-utils-loader.php

This file was deleted.

4 changes: 2 additions & 2 deletions inc/theme/navwalkers/class-navwalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @package MacrosBySara
*/

namespace MacrosBySara;
namespace MacrosBySara\Theme\Navwalkers;

use stdClass;
use Walker_Nav_Menu;
Expand Down Expand Up @@ -242,4 +242,4 @@ protected function get_the_attributes(): string {
$attributes['class'] .= ' nav-link';
return $this->build_atts( $attributes );
}
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "macros-by-sara-wp-theme",
"version": "2.0.2",
"version": "2.1.0",
"description": "A WordPress theme for Macros By Sara",
"homepage": "https://github.com/macrosbysara/wordpress-theme#readme",
"bugs": {
Expand Down Expand Up @@ -29,6 +29,7 @@
"assets/",
"build/",
"inc/",
"vendor/",
"parts/",
"patterns/",
"templates/",
Expand Down
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Theme URI: https://github.com/macrosbysara/wordpress-theme
Author: KJ Roelke
Author URI: https://kjroelke.online
Description: A WordPress Theme built for Macros By Sara site
Version: 2.2.0
Version: 3.0.0
Requires at least: 6.7.0
Tested up to: 6.9.4
Requires PHP: 8.2
Expand Down
Loading