upskill-event-manager/scripts/fix-child-theme-layout.sh
bengizmo b55b169750 Create Astra child theme and fix page layouts
- Created astra-child-hvac child theme with all HVAC page templates
- Applied Astra-specific layout settings to remove sidebars
- Set all HVAC pages to 'no-sidebar' layout using Astra meta
- Added custom CSS to child theme for full-width layouts
- Templates now properly render shortcode content without sidebars

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-29 07:30:05 -03:00

120 lines
No EOL
3.3 KiB
Bash
Executable file

#!/bin/bash
echo "=== Fixing Child Theme Layout for HVAC Pages ==="
# SSH into staging and update CSS
ssh roodev@146.190.76.204 << 'EOF'
cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html
# Create a more comprehensive CSS fix
cat > "wp-content/themes/astra-child-hvac/hvac-layout-fix.css" << 'CSS'
/* Force full-width layout on HVAC plugin pages */
/* Target pages by URL pattern */
body.wp-child-theme-astra-child-hvac .sidebar,
body.wp-child-theme-astra-child-hvac #secondary,
body.wp-child-theme-astra-child-hvac .widget-area,
body.wp-child-theme-astra-child-hvac aside.widget-area {
display: none !important;
}
/* Full width for main content area */
body.wp-child-theme-astra-child-hvac #primary,
body.wp-child-theme-astra-child-hvac .content-area,
body.wp-child-theme-astra-child-hvac .site-main,
body.wp-child-theme-astra-child-hvac main {
width: 100% !important;
max-width: 100% !important;
float: none !important;
margin: 0 auto !important;
}
/* Remove Astra's container constraints */
body.wp-child-theme-astra-child-hvac .ast-container {
max-width: 100% !important;
padding-left: 0;
padding-right: 0;
}
/* HVAC page wrapper */
body.wp-child-theme-astra-child-hvac .hvac-page-wrapper {
max-width: 1200px;
margin: 0 auto;
padding: 40px 20px;
}
/* Hide page titles */
body.wp-child-theme-astra-child-hvac .entry-title {
display: none !important;
}
/* Target specific HVAC pages by path */
body.page-id-5334 .sidebar,
body.page-id-5334 #secondary,
body.page-id-5334 .widget-area,
body.page-id-5333 .sidebar,
body.page-id-5333 #secondary,
body.page-id-5333 .widget-area,
body.page-id-5347 .sidebar,
body.page-id-5347 #secondary,
body.page-id-5347 .widget-area {
display: none !important;
}
body.page-id-5334 #primary,
body.page-id-5333 #primary,
body.page-id-5347 #primary {
width: 100% !important;
max-width: 100% !important;
}
CSS
# Update functions.php to enqueue the CSS
cat >> "wp-content/themes/astra-child-hvac/functions.php" << 'PHP'
/**
* Enqueue HVAC layout fixes
*/
function hvac_child_theme_styles() {
// Only load on pages that might be HVAC pages
if (is_page()) {
$current_url = $_SERVER['REQUEST_URI'];
$hvac_patterns = array('trainer', 'master-trainer', 'training-login', 'certificate', 'event');
foreach ($hvac_patterns as $pattern) {
if (strpos($current_url, $pattern) !== false) {
wp_enqueue_style('hvac-layout-fix', get_stylesheet_directory_uri() . '/hvac-layout-fix.css', array(), '1.0.1');
break;
}
}
}
}
add_action('wp_enqueue_scripts', 'hvac_child_theme_styles', 20);
/**
* Add body class for HVAC pages
*/
function hvac_body_classes($classes) {
if (is_page()) {
$current_url = $_SERVER['REQUEST_URI'];
$hvac_patterns = array('trainer', 'master-trainer', 'training-login', 'certificate', 'event');
foreach ($hvac_patterns as $pattern) {
if (strpos($current_url, $pattern) !== false) {
$classes[] = 'hvac-plugin-page';
$classes[] = 'hvac-full-width';
break;
}
}
}
return $classes;
}
add_filter('body_class', 'hvac_body_classes');
PHP
# Clear all caches
wp cache flush
wp breeze purge --cache=all
echo "Layout fixes applied successfully!"
EOF