#!/bin/bash

echo "=== Assigning Page Templates ==="

ssh roodev@146.190.76.204 << 'ENDSSH'
cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html

# Function to set page template
set_page_template() {
    local page_id="$1"
    local template="$2"
    
    echo "Setting template '$template' for page ID $page_id..."
    wp post meta update "$page_id" "_wp_page_template" "$template"
}

# Master Dashboard - ID 5347
set_page_template 5347 "page-master-dashboard.php"

# Trainer Registration - ID 5334
set_page_template 5334 "page-trainer-registration.php"

# Trainer Dashboard - ID 5333
set_page_template 5333 "page-trainer-dashboard.php"

# Trainer Profile - ID 5335
set_page_template 5335 "page-trainer-profile.php"

# Clear cache
wp cache flush
wp breeze purge --cache=all

echo -e "\n✅ Templates assigned and cache cleared"
ENDSSH