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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## 3.0.0 - [April 11, 2026]
## 3.0.1 - [April 11, 2026]

- Fixed: Add plugin handling back into the theme init

## 3.0.0

- Breaking: Swap to autoloading classes
- Added: PMPro handler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,19 @@ class ACF_Handler {
* Constructor function that initializes the ACF Handler.
*/
public function __construct() {
if ( ! defined( 'ACF_VERSION' ) ) {
return;
}

$this->base_path = get_stylesheet_directory() . '/inc/plugins/acf/acf-fields/';
$this->paths_array = array(
'field-group' => 'fields',
'post-type' => 'post-types',
'taxonomy' => 'taxonomies',
'ui-options-page' => 'options',
);
$this->init_save_filters();
add_filter( 'acf/settings/load_json', array( $this, 'load_json_paths' ) );
}

/**
* Loops through the paths array and adds filters to save ACF JSON files
*/
private function init_save_filters() {
public function init_save_filters() {
foreach ( $this->paths_array as $slug => $dir ) {
add_filter(
'acf/settings/save_json/type=acf-' . $slug,
Expand Down Expand Up @@ -82,4 +76,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;
}
}
}
34 changes: 34 additions & 0 deletions inc/theme/class-plugin-handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Plugin Handler Class
*
* @package MacrosBySara
*/

namespace MacrosBySara\Theme;

use MacrosBySara\Plugins\ACF_Handler;

/**
* Class: Plugin Handler
*/
class Plugin_Handler {
/**
* Handle plugins by checking if they are defined and initializing them.
*/
public function handle_plugins() {
$this->handle_acf();
}

/**
* Handle ACF by checking if it is defined and initializing the ACF Handler.
*/
private function handle_acf() {
if ( ! defined( 'ACF_VERSION' ) ) {
return;
}
$acf_handler = new ACF_Handler();
$acf_handler->init_save_filters();
add_filter( 'acf/settings/load_json', array( $acf_handler, 'load_json_paths' ) );
}
}
4 changes: 3 additions & 1 deletion inc/theme/class-theme-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class Theme_Init {
public function bootstrap_theme() {
$this->disable_discussion();
$this->configure_theme_support();
$plugin_handler = new Plugin_Handler();
$plugin_handler->handle_plugins();
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 @@ -132,4 +134,4 @@ public function handle_speculative_loading( $config ) {
}
return $config;
}
}
}
Loading