This repository was archived by the owner on Feb 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomet.php
More file actions
70 lines (62 loc) · 2.51 KB
/
Copy pathcomet.php
File metadata and controls
70 lines (62 loc) · 2.51 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
<?php
/**
* Plugin name: Comet Components for ACF Flexible Content
* Description: Double-E Design's foundational components for building page layouts using ACF Flexible Content modules.
*
* Author: Double-E Design
* Author URI: https://www.doubleedesign.com.au
* Version: 0.5.0
* Requires PHP: 8.3
* Requires plugins: advanced-custom-fields-pro
* Recommends plugins: doublee-breadcrumbs, acf-advanced-image-field
* Text Domain: comet
*
* @package Comet
*/
if (!defined('COMET_COMPOSER_VENDOR_URL')) {
define('COMET_COMPOSER_VENDOR_URL', get_site_url() . '/wp-content/plugins/comet-plugin-acf/vendor');
}
if (!defined('COMET_COMPOSER_VENDOR_PATH')) {
define('COMET_COMPOSER_VENDOR_PATH', __DIR__ . '/vendor');
}
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/vendor/doubleedesign/comet-components-core/src/base/Config.php';
use Doubleedesign\Comet\Core\Config;
use Doubleedesign\Comet\WordPress\Classic\{PluginEntryPoint, TemplateHandler};
add_action('plugins_loaded', function() {
if (!class_exists('Doubleedesign\Comet\Core\Config')) {
wp_die('<p>Comet Components Core Config class not found in Comet Components ACF plugin. Perhaps you need to install or update Composer dependencies.</p><p>If you are working locally with symlinked packages, you might want <code>$env:COMPOSER = "composer.local.json"; composer update</code>.</p>');
}
// Ensure Config is initialised early
Config::init();
}, 5);
// Need to use full namespaces in this file because use statements don't work on Apache webserver for some reason
new PluginEntryPoint();
function activate_comet_plugin_acf(): void {
PluginEntryPoint::activate();
}
function deactivate_comet_plugin_acf(): void {
PluginEntryPoint::deactivate();
}
function uninstall_comet_plugin_acf(): void {
PluginEntryPoint::uninstall();
}
register_activation_hook(__FILE__, 'activate_comet_plugin_acf');
register_deactivation_hook(__FILE__, 'deactivate_comet_plugin_acf');
register_uninstall_hook(__FILE__, 'uninstall_comet_plugin_acf');
/**
* Add a global alias for the content rendering method so themes can use it without namespacing/autoloading/etc issues.
*
* @param $post_id
*
* @return string
*/
function comet_acf_render_flexible_content($post_id): string {
return TemplateHandler::render_flexible_content($post_id);
}
// Workaround for a missing ACF function in ClassicPress
if (!function_exists('has_blocks')) {
function has_blocks() {
return false;
}
}