From b55b169750ebfbae67e38c1175e5210e40a613ca Mon Sep 17 00:00:00 2001 From: bengizmo Date: Tue, 29 Jul 2025 07:30:05 -0300 Subject: [PATCH] Create Astra child theme and fix page layouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- scripts/add-child-theme-css.sh | 71 +++++++++++++++++ scripts/copy-templates-to-theme.sh | 38 +++++---- scripts/create-child-theme.sh | 121 +++++++++++++++++++++++++++++ scripts/fix-child-theme-layout.sh | 120 ++++++++++++++++++++++++++++ scripts/force-full-width-layout.sh | 40 ++++++++++ scripts/reassign-templates.sh | 39 ++++++++++ 6 files changed, 414 insertions(+), 15 deletions(-) create mode 100755 scripts/add-child-theme-css.sh create mode 100755 scripts/create-child-theme.sh create mode 100755 scripts/fix-child-theme-layout.sh create mode 100755 scripts/force-full-width-layout.sh create mode 100755 scripts/reassign-templates.sh diff --git a/scripts/add-child-theme-css.sh b/scripts/add-child-theme-css.sh new file mode 100755 index 00000000..05f46be9 --- /dev/null +++ b/scripts/add-child-theme-css.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +echo "=== Adding CSS to Child Theme ===" + +# SSH into staging and add CSS +ssh roodev@146.190.76.204 << 'EOF' +cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html + +# Add custom CSS to child theme style.css +cat >> "wp-content/themes/astra-child-hvac/style.css" << 'CSS' + +/* HVAC Community Events - Hide sidebars and ensure full width */ +body.page-template-page-trainer-registration .sidebar, +body.page-template-page-trainer-registration #secondary, +body.page-template-page-trainer-registration .widget-area, +body.page-template-page-trainer-dashboard .sidebar, +body.page-template-page-trainer-dashboard #secondary, +body.page-template-page-trainer-dashboard .widget-area, +body.page-template-page-master-dashboard .sidebar, +body.page-template-page-master-dashboard #secondary, +body.page-template-page-master-dashboard .widget-area, +body[class*="page-template-page-"] .sidebar, +body[class*="page-template-page-"] #secondary, +body[class*="page-template-page-"] .widget-area { + display: none !important; +} + +/* Full width content for HVAC pages */ +body[class*="page-template-page-"] #primary, +body[class*="page-template-page-"] .content-area, +body[class*="page-template-page-"] .site-main { + width: 100% !important; + max-width: 100% !important; + margin: 0 auto; +} + +/* Remove default container constraints */ +body[class*="page-template-page-"] .ast-container { + max-width: 100% !important; + padding: 0; +} + +/* HVAC page wrapper styles */ +.hvac-page-wrapper { + width: 100%; + max-width: 1200px; + margin: 0 auto; + padding: 40px 20px; +} + +/* Hide page titles on HVAC pages */ +body[class*="page-template-page-"] .entry-title { + display: none !important; +} + +/* Ensure proper layout for HVAC content */ +body[class*="page-template-page-"] .site-content { + padding: 0; +} + +body[class*="page-template-page-"] .site-content .ast-container { + display: block; +} +CSS + +# Clear all caches +wp cache flush +wp breeze purge --all + +echo "CSS added to child theme successfully!" +EOF \ No newline at end of file diff --git a/scripts/copy-templates-to-theme.sh b/scripts/copy-templates-to-theme.sh index 0e55749a..d116c8cc 100755 --- a/scripts/copy-templates-to-theme.sh +++ b/scripts/copy-templates-to-theme.sh @@ -1,25 +1,33 @@ #!/bin/bash -echo "=== Copying Templates to Theme Directory ===" +echo "=== Copying Page Templates to Theme Directory ===" -ssh roodev@146.190.76.204 << 'ENDSSH' +# SSH into staging and copy templates +ssh roodev@146.190.76.204 << 'EOF' cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html -# Create hvac-community-events directory in theme -echo "Creating template override directory in theme..." -mkdir -p wp-content/themes/astra/hvac-community-events +# Get active theme directory +THEME_DIR=$(wp theme path $(wp theme list --status=active --field=name)) +echo "Active theme directory: $THEME_DIR" + +# Create hvac-community-events directory in theme if it doesn't exist +mkdir -p "$THEME_DIR/hvac-community-events" + +# Copy page templates from plugin to theme +PLUGIN_DIR="wp-content/plugins/hvac-community-events" -# Copy all page templates echo "Copying page templates..." -cp wp-content/plugins/hvac-community-events/templates/page-*.php wp-content/themes/astra/hvac-community-events/ - -# List copied files -echo -e "\nCopied templates:" -ls -la wp-content/themes/astra/hvac-community-events/page-*.php +if [ -d "$PLUGIN_DIR/templates" ]; then + # Copy all page-*.php files + find "$PLUGIN_DIR/templates" -name "page-*.php" -exec cp {} "$THEME_DIR/hvac-community-events/" \; + + # List copied files + echo "Templates copied to theme:" + ls -la "$THEME_DIR/hvac-community-events/" +else + echo "Plugin templates directory not found!" +fi # Clear cache wp cache flush -wp breeze purge --cache=all - -echo -e "\nāœ… Templates copied to theme directory" -ENDSSH \ No newline at end of file +EOF \ No newline at end of file diff --git a/scripts/create-child-theme.sh b/scripts/create-child-theme.sh new file mode 100755 index 00000000..883b5216 --- /dev/null +++ b/scripts/create-child-theme.sh @@ -0,0 +1,121 @@ +#!/bin/bash + +echo "=== Creating Astra Child Theme for HVAC Community Events ===" + +# SSH into staging and create child theme +ssh roodev@146.190.76.204 << 'EOF' +cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html + +# Create child theme directory +CHILD_THEME_DIR="wp-content/themes/astra-child-hvac" +echo "Creating child theme directory: $CHILD_THEME_DIR" +mkdir -p "$CHILD_THEME_DIR" + +# Create style.css for child theme +cat > "$CHILD_THEME_DIR/style.css" << 'STYLE' +/* +Theme Name: Astra Child - HVAC Community Events +Theme URI: https://upskill.measurequick.com +Author: Ben Reed +Author URI: https://tealmaker.com +Description: Child theme for Astra to support HVAC Community Events plugin templates +Template: astra +Version: 1.0.0 +License: GPL v2 or later +Text Domain: astra-child-hvac +*/ + +/* Import parent theme styles */ +@import url("../astra/style.css"); + +/* Custom styles for HVAC Community Events can be added below */ +STYLE + +# Create functions.php for child theme +cat > "$CHILD_THEME_DIR/functions.php" << 'PHP' + 'Trainer Dashboard', + 'page-trainer-registration.php' => 'Trainer Registration', + 'page-master-dashboard.php' => 'Master Dashboard', + 'page-trainer-login.php' => 'Trainer Login', + 'page-trainer-profile.php' => 'Trainer Profile', + 'page-manage-event.php' => 'Manage Event', + 'page-event-summary.php' => 'Event Summary', + 'page-certificate-reports.php' => 'Certificate Reports', + 'page-generate-certificates.php' => 'Generate Certificates', + 'page-email-attendees.php' => 'Email Attendees', + 'page-communication-templates.php' => 'Communication Templates', + 'page-communication-schedules.php' => 'Communication Schedules', + 'page-documentation.php' => 'Documentation', + 'page-attendee-profile.php' => 'Attendee Profile', + 'page-google-sheets.php' => 'Google Sheets', + 'page-certificate-fix.php' => 'Certificate Fix', + 'page-trainer-account-pending.php' => 'Account Pending', + 'page-trainer-account-disabled.php' => 'Account Disabled', + 'page-registration-pending.php' => 'Registration Pending', + ); + + return array_merge( $templates, $hvac_templates ); +}, 10, 1 ); +PHP + +# Create screenshot placeholder +echo "Creating screenshot placeholder..." +cat > "$CHILD_THEME_DIR/screenshot.png" << 'SCREENSHOT' +# This is a placeholder - replace with actual screenshot +SCREENSHOT + +# Activate the child theme +echo "Activating child theme..." +wp theme activate astra-child-hvac + +# Create directory for HVAC templates +mkdir -p "$CHILD_THEME_DIR/hvac-community-events" + +# Copy templates from plugin to child theme +PLUGIN_DIR="wp-content/plugins/hvac-community-events" +if [ -d "$PLUGIN_DIR/templates" ]; then + echo "Copying page templates to child theme..." + find "$PLUGIN_DIR/templates" -name "page-*.php" -exec cp {} "$CHILD_THEME_DIR/" \; + + echo "Templates copied:" + ls -la "$CHILD_THEME_DIR"/page-*.php +fi + +# Clear cache +wp cache flush +echo "Child theme created and activated successfully!" + +# Show theme info +wp theme get astra-child-hvac --fields=name,status,version +EOF \ No newline at end of file diff --git a/scripts/fix-child-theme-layout.sh b/scripts/fix-child-theme-layout.sh new file mode 100755 index 00000000..44a171a1 --- /dev/null +++ b/scripts/fix-child-theme-layout.sh @@ -0,0 +1,120 @@ +#!/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 \ No newline at end of file diff --git a/scripts/force-full-width-layout.sh b/scripts/force-full-width-layout.sh new file mode 100755 index 00000000..314d6fbe --- /dev/null +++ b/scripts/force-full-width-layout.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +echo "=== Forcing Full Width Layout for HVAC Pages ===" + +# SSH into staging and force full width +ssh roodev@146.190.76.204 << 'EOF' +cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html + +# Update page meta to force no sidebar +echo "Setting page layout to no-sidebar..." + +# Get all HVAC related pages +HVAC_PAGES=$(wp post list --post_type=page --fields=ID,post_title --format=csv | grep -E "(Trainer|Master|Certificate|Event|Registration|Login)" | cut -d',' -f1 | grep -v "ID") + +for page_id in $HVAC_PAGES; do + if [ ! -z "$page_id" ]; then + echo "Updating page $page_id to no-sidebar layout" + # Astra uses this meta key for sidebar layout + wp post meta update $page_id ast-site-content-layout "no-sidebar" + wp post meta update $page_id site-content-layout "no-sidebar" + wp post meta update $page_id site-sidebar-layout "no-sidebar" + + # Also add theme-specific layout settings + wp post meta update $page_id _astra_content_layout_flag "disabled" + wp post meta update $page_id ast-featured-img "disabled" + wp post meta update $page_id ast-title-bar-display "disabled" + fi +done + +# List updated pages +echo -e "\nUpdated pages:" +wp post list --post_type=page --meta_key=ast-site-content-layout --meta_value=no-sidebar --fields=ID,post_title --format=table + +# Clear all caches +wp cache flush +wp breeze purge --cache=all +wp opcache reset + +echo "Full width layout forced successfully!" +EOF \ No newline at end of file diff --git a/scripts/reassign-templates.sh b/scripts/reassign-templates.sh new file mode 100755 index 00000000..078b801c --- /dev/null +++ b/scripts/reassign-templates.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +echo "=== Reassigning Page Templates ===" + +# SSH into staging and reassign templates +ssh roodev@146.190.76.204 << 'EOF' +cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html + +# Get all HVAC pages and update their templates +echo "Finding and updating HVAC pages..." + +# Update trainer registration page +wp post list --post_type=page --meta_key=_wp_page_template --meta_value=page-trainer-registration.php --field=ID | while read page_id; do + echo "Updating page $page_id - Trainer Registration" + wp post meta update $page_id _wp_page_template "page-trainer-registration.php" +done + +# Update trainer dashboard +wp post list --post_type=page --name=dashboard --post_parent=5332 --field=ID | while read page_id; do + echo "Updating page $page_id - Trainer Dashboard" + wp post meta update $page_id _wp_page_template "page-trainer-dashboard.php" +done + +# Update master dashboard +wp post list --post_type=page --name=dashboard --post_parent=5346 --field=ID | while read page_id; do + echo "Updating page $page_id - Master Dashboard" + wp post meta update $page_id _wp_page_template "page-master-dashboard.php" +done + +# List all pages with their templates +echo -e "\nCurrent page templates:" +wp post list --post_type=page --meta_key=_wp_page_template --fields=ID,post_title,post_name --format=table | head -20 + +# Clear all caches +wp cache flush +wp breeze purge --cache=all + +echo "Templates reassigned successfully!" +EOF \ No newline at end of file