upskill-event-manager/templates/page-manage-event.php
bengizmo 0a627a6a1f fix: Remove persistent HTML comment from manage event page
- Modified page-manage-event.php template to access raw post content directly
- Added comprehensive regex patterns to strip all variations of wp:shortcode comments
- Disabled the_content filter in HVAC_Manage_Event class to prevent conflicts
- Added client-side JavaScript fallback to remove any remaining HTML comments
- Created cache clearing script for troubleshooting

The issue was that apply_filters('the_content') was potentially re-adding
content after we stripped the HTML comments. Now we bypass all filters
and process the raw content directly.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-30 11:27:58 -03:00

61 lines
No EOL
2.2 KiB
PHP

<?php
/**
* Template Name: Manage Event
* Description: Template for managing events (uses The Events Calendar)
*/
get_header();
// The Events Calendar handles the event creation/editing interface
// This template ensures proper WordPress theme integration
?>
<div class="hvac-event-manage-wrapper">
<!-- Navigation Header -->
<div class="hvac-dashboard-header">
<h1 class="entry-title">Create Event</h1>
<div class="hvac-dashboard-nav">
<a href="/trainer/dashboard/" class="ast-button ast-button-secondary">Dashboard</a>
<a href="/trainer/certificate-reports/" class="ast-button ast-button-secondary">Certificate Reports</a>
<a href="/trainer/generate-certificates/" class="ast-button ast-button-secondary">Generate Certificates</a>
<button class="ast-button hvac-help-trigger">Help</button>
</div>
</div>
<?php
// Let The Events Calendar handle the content
if (have_posts()) :
while (have_posts()) : the_post();
// Get the raw content WITHOUT any filters
global $post;
$raw_content = $post->post_content;
// Strip ALL HTML comments that might contain shortcode references
// Use multiple patterns to catch all variations
$patterns = [
'/<!--\s*wp:shortcode\s*-->/s',
'/<!--\s*\/wp:shortcode\s*-->/s',
'/<!--[^>]*wp:shortcode[^>]*-->/s',
'/<!--.*?-->/s' // Catch all remaining HTML comments
];
foreach ($patterns as $pattern) {
$raw_content = preg_replace($pattern, '', $raw_content);
}
// Clean up any extra whitespace
$raw_content = trim($raw_content);
// Process shortcodes directly without the_content filter
$processed = do_shortcode($raw_content);
// Output the processed content
echo $processed;
endwhile;
else:
// No posts found - show the shortcode directly
echo do_shortcode('[tribe_community_events]');
endif;
?>
</div>
<?php
get_footer();