-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustom-page-archive.php
40 lines (35 loc) · 1.09 KB
/
custom-page-archive.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Plugin Name: Custom post type archive
* Description: Customize post type archive pages
* Version: 1.0
* Author: Acti
* Author URI: https://www.acti.fr/
* Text Domain: menu-page-archive
* Domain Path: /languages
*/
define('CPA_SRC_PATH', __DIR__ . '/src');
final class CustomPageArchive
{
public function __construct()
{
spl_autoload_register(array($this, 'loadFiles'));
new CPA\CustomPageArchiveProcess();
}
public function loadFiles($className)
{
if (strpos($className, 'CPA') !== false) {
$className = str_replace('CPA\\', '', $className);
$className = str_replace("\\", "/", $className);
$file = CPA_SRC_PATH. "/" . (empty($namespace) ? "" : $namespace . "/") . "{$className}.php";
if (file_exists($file)) {
include_once($file);
if (class_exists($className)) {
return true;
}
}
}
return false;
}
}
new CustomPageArchive();