-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
84 lines (69 loc) · 2.81 KB
/
functions.php
File metadata and controls
84 lines (69 loc) · 2.81 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
/**
* Theme Name: Yivic Lite
* Theme URI: https://github.com/manhphuc/yivic-lite
* Description: A clean and lightweight classic theme focused on readability and simple layout structure. Designed with modern HTML5 standards, customizer options, and flexible templates for blogs and personal sites.
* Author: Phuc Nguyen
* Author URI: https://github.com/manhphuc
* Version: 1.1.2
* Text Domain: yivic-lite
*/
defined( 'ABSPATH' ) || exit;
/*
|--------------------------------------------------------------------------
| Theme Constants
|--------------------------------------------------------------------------
*/
defined( 'YIVIC_LITE_VERSION' ) || define( 'YIVIC_LITE_VERSION', '1.1.2' );
defined( 'YIVIC_LITE_SLUG' ) || define( 'YIVIC_LITE_SLUG', 'yivic-lite' );
/*
|--------------------------------------------------------------------------
| Autoload: Composer (if available) → Fallback to Theme Autoloader
|--------------------------------------------------------------------------
|
| 1. Prefer Composer's autoloader when the theme is in development mode
| or installed manually by a developer.
|
| 2. If the theme is downloaded from WordPress.org (vendor removed),
| gracefully fall back to our lightweight PSR-4 autoloader located in:
| src/YivicLite_Theme_Autoloader.php
|
| This ensures the theme works in every environment without requiring
| Composer or any external build tools.
|
*/
$composerAutoload = __DIR__ . '/vendor/autoload.php';
$fallbackAutoload = __DIR__ . '/src/YivicLite_Theme_Autoloader.php';
if ( file_exists( $composerAutoload ) ) {
// Prefer Composer when developing or running a packaged build
require_once $composerAutoload;
} elseif ( file_exists( $fallbackAutoload ) ) {
// Theme was downloaded from WP.org → vendor folder removed
require_once $fallbackAutoload;
} else {
// Edge-case: autoloader missing completely → warn only in debug mode
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log(
'[Yivic Lite] ERROR: No autoloader found. Checked:' . PHP_EOL .
'- ' . $composerAutoload . PHP_EOL .
'- ' . $fallbackAutoload
);
}
}
/*
|--------------------------------------------------------------------------
| Bootstrap Theme Kernel
|--------------------------------------------------------------------------
*/
try {
$config = require( __DIR__ . DIRECTORY_SEPARATOR . 'config.php' );
$config = array_merge( $config, [
'themeFilename' => __FILE__,
] );
\Yivic\YivicLite\Theme\WP\YivicLite_WP_Theme::initInstanceWithConfig( $config );
\Yivic\YivicLite\Theme\WP\YivicLite_WP_Theme::getInstance()->initTheme();
} catch ( Throwable $e ) {
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
error_log( '[Yivic Lite] Bootstrap failed: ' . $e->getMessage() );
}
}