-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage-about-test.php
More file actions
91 lines (78 loc) · 3.68 KB
/
page-about-test.php
File metadata and controls
91 lines (78 loc) · 3.68 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
85
86
87
88
89
90
91
<?php
/*
Template Name: About Page Test
*/
get_header();
// Check if this page has Elementor data and auto-populate if empty
if (have_posts()) :
while (have_posts()) : the_post();
// Check if this page has Elementor data
$post_id = get_the_ID();
$elementor_data = get_post_meta($post_id, '_elementor_data', true);
// Debug: Always log what we find
error_log("About page loaded. Post ID: " . $post_id);
error_log("Existing Elementor data: " . (empty($elementor_data) ? 'EMPTY' : 'EXISTS'));
// Force creation of new data for testing
if (true) { // Changed from checking empty to always create
error_log("Creating default Elementor content for About page");
// Simple test structure first
$default_content = [
[
'id' => '1a2b3c4d',
'elType' => 'section',
'settings' => [
'background_background' => 'classic',
'background_color' => '#1a1f2e'
],
'elements' => [
[
'id' => '2b3c4d5e',
'elType' => 'column',
'settings' => [
'_column_size' => 100
],
'elements' => [
[
'id' => '3c4d5e6f',
'elType' => 'widget',
'widgetType' => 'heading',
'settings' => [
'title' => 'Expert DevOps Engineering from Croatia - TEST VERSION',
'size' => 'xl',
'color' => '#ffffff'
]
],
[
'id' => '4d5e6f7g',
'elType' => 'widget',
'widgetType' => 'text-editor',
'settings' => [
'editor' => '<p>This is a test paragraph to see if our Elementor data is working correctly. If you can see this in Elementor editor, it means our logic is working!</p>',
'text_color' => '#94a3b8'
]
]
]
]
]
]
];
// Convert to JSON and save as Elementor data
$elementor_data_json = json_encode($default_content);
// Debug: Log the JSON data
error_log("Elementor data JSON: " . $elementor_data_json);
// Update post meta with Elementor data
update_post_meta($post_id, '_elementor_data', $elementor_data_json);
update_post_meta($post_id, '_elementor_edit_mode', 'builder');
update_post_meta($post_id, '_elementor_template_type', 'wp-page');
update_post_meta($post_id, '_elementor_version', '3.21.0');
// Clear any caches
if (class_exists('\Elementor\Plugin')) {
\Elementor\Plugin::$instance->files_manager->clear_cache();
}
error_log("Elementor data saved for page ID: " . $post_id);
}
// Display the content
the_content();
endwhile;
endif;
get_footer(); ?>