#!/bin/bash # Fix Page Shortcodes Script # Updates WordPress pages to include their respective shortcodes echo "=== Fixing Page Shortcodes ===" # Define pages and their shortcodes declare -A page_shortcodes=( ["trainer/dashboard"]="[hvac_dashboard]" ["master-trainer/dashboard"]="[hvac_master_dashboard]" ["trainer/registration"]="[hvac_trainer_registration]" ["trainer/my-profile"]="[hvac_trainer_profile]" ["trainer/event/manage"]="[hvac_manage_event]" ["trainer/event/summary"]="[hvac_event_summary]" ["trainer/certificate-reports"]="[hvac_certificate_reports]" ["trainer/generate-certificates"]="[hvac_generate_certificates]" ["trainer/email-attendees"]="[hvac_email_attendees]" ["trainer/communication-templates"]="[hvac_communication_templates]" ["trainer/communication-schedules"]="[hvac_communication_schedules]" ["master-trainer/google-sheets"]="[hvac_google_sheets]" ) # SSH to staging and update pages ssh roodev@146.190.76.204 << 'ENDSSH' cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html # Function to update page content update_page_content() { local slug="$1" local shortcode="$2" echo "Updating $slug with shortcode $shortcode..." # Get page ID by path page_id=$(wp post list --post_type=page --pagename="$slug" --field=ID --format=ids) if [ -n "$page_id" ]; then # Update page content with shortcode wp post update "$page_id" --post_content="$shortcode" echo "✅ Updated page $slug (ID: $page_id)" else echo "❌ Page not found: $slug" fi } # Update each page update_page_content "trainer-dashboard" "[hvac_dashboard]" update_page_content "master-dashboard" "[hvac_master_dashboard]" update_page_content "trainer-registration" "[hvac_trainer_registration]" update_page_content "trainer-profile" "[hvac_trainer_profile]" update_page_content "manage-event" "[hvac_manage_event]" update_page_content "event-summary" "[hvac_event_summary]" update_page_content "certificate-reports" "[hvac_certificate_reports]" update_page_content "generate-certificates" "[hvac_generate_certificates]" update_page_content "email-attendees" "[hvac_email_attendees]" update_page_content "communication-templates" "[hvac_communication_templates]" update_page_content "communication-schedules" "[hvac_communication_schedules]" update_page_content "google-sheets" "[hvac_google_sheets]" # Clear cache wp cache flush wp breeze purge --all echo "✅ Page shortcodes fixed and cache cleared" ENDSSH echo "=== Script Complete ==="