Version: 1.0.0 Author: Elliot Telford License: GPL v2 or later
A cutting-edge WordPress theme for creating interactive astrophysical simulations using Three.js, React, and TypeScript. Perfect for educators, astronomy enthusiasts, researchers, and simulation creators.
- 🎮 Interactive 3D Simulations - Solar systems, galaxies, black holes, and more
- ⚙️ Multiple Physics Engines - Cannon.js, Ammo.js, and GPU compute shaders
- 🎨 Three Visual Themes - Dark Cosmic, Light Playful, and Science Mode (light/dark)
- 💎 Premium Subscriptions - Built-in Stripe/WooCommerce integration
- 🛠️ Blueprint Creator - Users can create and share simulation configurations
- 🏆 Gamification - Achievements, challenges, leaderboards
- 👥 Community Features - Gallery, forums, voting system
- 📱 Mobile-First Design - WebGPU for desktop, WebGL fallback for mobile
- ♿ Accessibility - WCAG 2.1 AA compliant, screen reader support
- 🔌 Headless Architecture - WPGraphQL API + React frontend
- WordPress: 6.0 or higher
- PHP: 8.0 or higher
- Node.js: 18+ (for building frontend assets)
- Plugins (Required):
- WPGraphQL
- Advanced Custom Fields Pro
- WooCommerce (for subscriptions)
- WooCommerce Subscriptions
# Clone or download the theme
git clone https://github.com/etelford32/Infinity_Wordpress_Theme.git
# Move to WordPress themes directory
mv Infinity_Wordpress_Theme /path/to/wordpress/wp-content/themes/infinity
# Or upload via WordPress admin: Appearance > Themes > Add New > Upload Theme- Go to Plugins > Add New
- Install and activate:
- WPGraphQL
- Advanced Custom Fields Pro
- WooCommerce
- WooCommerce Subscriptions
cd /path/to/wordpress/wp-content/themes/infinity/frontend
# Install dependencies
npm install
# Build for production
npm run build
# Or run development server
npm run dev- Go to Appearance > Themes
- Activate Infinity
- The theme will automatically:
- Create custom post types (Simulations, Blueprints, Challenges)
- Set up user roles (Premium Subscriber)
- Create database tables for analytics
- Configure WooCommerce subscription products
Go to Appearance > Customize to configure:
- Dark Cosmic - Deep space aesthetic with nebula colors
- Light Playful - Bright, friendly UI with pastel accents
- Science Mode (Light) - Professional academic styling, light variant
- Science Mode (Dark) - Professional academic styling, dark variant
- Stripe Publishable Key - Your Stripe public API key
- Premium Monthly Price - Set subscription price (default: $20/month)
- Go to Appearance > Menus
- Create menus for:
- Primary Menu - Main navigation
- Footer Menu - Footer links
- Sidebar - Blog and page sidebar
- Footer - Footer widget area
Main content type for interactive simulations.
Custom Fields:
simulation_config(JSON) - Simulation configurationphysics_engine(string) - cannon, ammo, or gpuis_premium(boolean) - Requires subscriptionallow_parameter_control(boolean) - Users can modify parametersmin_fps(integer) - Target minimum frame rateparticle_count(integer) - Number of objectsplay_count(integer) - Times simulation has been runavg_session_duration(integer) - Average time spent (seconds)
Taxonomies:
simulation_category- Solar System, Galaxy, Black Hole, etc.difficulty_level- Beginner, Intermediate, Advancedphysics_engine- Cannon.js, Ammo.js, GPU Compute
User-created simulation configurations.
Custom Fields:
blueprint_config(JSON) - User's configurationbase_simulation_id(integer) - Source simulationvisibility(string) - public, private, unlistedvote_count(integer) - Community upvotesfork_count(integer) - Times forkedforked_from(integer) - Parent blueprint ID
Weekly/monthly simulation challenges.
Custom Fields:
challenge_config(JSON) - Challenge setupsuccess_criteria(JSON) - Completion requirementsstart_date/end_date(datetime) - Challenge periodcompletion_count(integer) - Users who completedattempt_count(integer) - Total attempts
Base URL: /wp-json/infinity/v1/
GET /simulation/{id}/access
Response: {
"can_access": true,
"reason": "",
"is_premium": false,
"is_user_premium": false,
"remaining_simulations": 2
}
POST /simulation/{id}/track
Body: { "duration": 300 }
Response: {
"success": true,
"remaining_simulations": 1
}
GET /user/stats
Response: {
"user_id": 123,
"is_premium": true,
"blueprints_created": 5,
"challenges_completed": 3,
"simulations_today": 0,
"remaining_today": -1
}
POST /blueprint/{id}/vote
Body: { "vote": "up" }
Response: {
"success": true,
"vote_count": 42,
"user_vote": "up"
}
POST /blueprint/{id}/fork
Response: {
"success": true,
"forked_id": 456,
"edit_url": "..."
}
- React 18+ - UI framework
- TypeScript - Type safety
- Three.js + React Three Fiber - 3D rendering
- Next.js / Vite - Build system
- TailwindCSS - Styling
- Zustand / Jotai - State management
- Cannon.js / Ammo.js - Physics engines
frontend/
├── src/
│ ├── components/ # React components
│ │ ├── Layout/
│ │ ├── Simulation/
│ │ ├── Blueprint/
│ │ └── UI/
│ ├── simulations/ # Simulation implementations
│ │ ├── SolarSystem/
│ │ ├── Galaxy/
│ │ └── BlackHole/
│ ├── lib/ # Utilities
│ │ ├── physics/
│ │ ├── api/
│ │ └── utils/
│ ├── hooks/ # Custom React hooks
│ ├── types/ # TypeScript types
│ └── styles/ # Global styles
├── public/ # Static assets
└── package.json
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Type checking
npm run type-check
# Linting
npm run lint- Create simulation component in
src/simulations/YourSimulation/ - Implement physics using chosen engine
- Register in simulation registry
- Create WordPress post with matching configuration
Example simulation structure:
// src/simulations/SolarSystem/index.tsx
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/cannon';
export const SolarSystem = ({ config }) => {
return (
<Canvas>
<Physics>
<Sun />
<Planet name="Earth" {...config.earth} />
<Planet name="Mars" {...config.mars} />
</Physics>
</Canvas>
);
};- 2 simulation runs per day
- View-only parameter controls
- Read-only forum access
- View community gallery
- Unlimited simulation runs
- Full parameter control
- Blueprint creator access
- Code tutorials & walkthroughs
- Download simulation configs (JSON)
- Forum posting & DMs
- Upload to community gallery
- Participate in challenges
- All premium features
- Manage simulations, blueprints, challenges
- Moderate user content
- View analytics dashboard
- Configure subscription settings
Simulations are configured using JSON stored in post meta.
Example configuration:
{
"version": "1.0",
"engine": "cannon",
"scene": {
"background": "space",
"cameraPosition": [0, 10, 20]
},
"bodies": [
{
"id": "sun",
"type": "sphere",
"radius": 5,
"mass": 1000000,
"position": [0, 0, 0],
"material": {
"color": "#FDB813",
"emissive": "#FF9500"
}
},
{
"id": "earth",
"type": "sphere",
"radius": 1,
"mass": 100,
"position": [15, 0, 0],
"velocity": [0, 0, 5],
"material": {
"texture": "/textures/earth.jpg"
}
}
],
"controls": {
"allowMassChange": true,
"allowVelocityChange": true,
"allowAddRemove": false
},
"tutorial": {
"enabled": true,
"steps": [
"Use mouse to rotate camera",
"Scroll to zoom in/out",
"Click planet to see information"
]
}
}The theme tracks:
- Simulation play counts
- Average session duration
- User engagement metrics
- Subscription conversions
- Challenge completion rates
- Blueprint popularity (votes, forks)
Access analytics via WordPress admin or GraphQL API.
- All user input is sanitized and validated
- Nonce verification on form submissions
- Capability checks for restricted actions
- Rate limiting on API endpoints
- CORS configured for headless setup
- Stripe handles all payment data (PCI compliant)
cd frontend
# Connect to Vercel
vercel
# Set environment variables
vercel env add WORDPRESS_API_URL
vercel env add NEXT_PUBLIC_STRIPE_KEY
# Deploy
vercel --prod- Push WordPress files to WP Engine Git
- Install plugins via WP Engine dashboard
- Configure Stripe keys in Customizer
- Set up SSL certificate
- Configure headless CORS settings
# .env.local (frontend)
WORDPRESS_API_URL=https://your-site.com/graphql
NEXT_PUBLIC_STRIPE_KEY=pk_live_...
NEXT_PUBLIC_SITE_URL=https://your-frontend.vercel.app- Check browser console for errors
- Verify
frontend/dist/files exist - Rebuild frontend:
npm run build - Clear WordPress cache
- Ensure WPGraphQL plugin is active
- Flush permalinks: Settings > Permalinks > Save
- Check
/graphqlendpoint is accessible
- Verify Stripe keys are set
- Check WooCommerce Subscriptions is active
- Test webhook endpoints
- Enable WordPress object caching
- Use CDN for assets
- Optimize 3D models (< 10MB)
- Reduce particle counts for mobile
Full documentation available at:
- User Guide - For theme users
- Developer Guide - For developers
- API Reference - REST & GraphQL APIs
Contributions welcome! Please:
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
This theme is licensed under the GNU General Public License v2 or later.
- Three.js - 3D graphics library
- React Three Fiber - React renderer for Three.js
- Cannon.js - Physics engine
- Ammo.js - Physics engine
- WordPress - CMS platform
- WPGraphQL - GraphQL API
- VR/AR support (WebXR)
- Real-time multiplayer simulations
- Mobile app (React Native)
- Advanced analytics dashboard
- AI-assisted simulation creation
- Educational curriculum integration
- LMS plugins (Canvas, Moodle)
- Multi-language support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@example.com
Made with ❤️ and ☕ by the Infinity team