Skip to main content
100%

Simple autoloader, customised the Zend autoloader to work with wordpress parent & child themes. Tries Parent and then fallsback to child. Could easily be reversed.

✓ Published0🌍 Public
SSimonS
Last edited Mar 8, 2012
Created on Mar 8, 2012

This example demonstrates a custom PHP autoloader designed for WordPress parent and child themes. It shows a fallback strategy where the autoloader first attempts to load a class from the parent theme’s directory path, then falls back to the child theme’s `/class/` directory. The code uses the `__autoload()` function, `realpath()`, `file_exists()`, and `require_once` to resolve class names by converting underscores to directory separators. The logic relies on the theme directory structure to locate PHP class files.

AI-generated description

Similar vizzes