WP Manifestindependent plugin directory
manifest / content / wp_sports_predictions

Sports Predictions

This plugin implements to integration the membership plugin and discord channel for thevaluedStats.com

by Valued Stats · github.com/srcore9179/wp_sports_predictions

★ 0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/srcore9179/wp_sports_predictions/archive/refs/heads/main.zip

Sports Predictions Plugin - Implementation Guide

Installation

  1. Create a folder called sports-predictions in your WordPress wp-content/plugins/ directory

  2. Create the following folder structure:

    sports-predictions/
    ├── assets/
    │   ├── css/
    │   └── js/
    └── includes/
  3. Add the following files with their respective contents:

    • sports-predictions.php (Main plugin file)
    • includes/api.php (API handling)
    • includes/helpers.php (Helper functions)
    • includes/shortcodes.php (Shortcode implementation)
    • assets/css/sports-predictions.css (Styling)
    • assets/js/sports-predictions.js (JavaScript)
  4. Activate the plugin from your WordPress admin panel

Using the Shortcode

Add the shortcode to any page or post:

[sports_predictions sport="NBA"]

Basic Examples

NBA Predictions with Auto-Refresh:

[sports_predictions]

NFL Predictions:

[sports_predictions sport="NFL"]

NHL Predictions with Custom Refresh Rate:

[sports_predictions sport="NHL" refresh_interval="120"]

MLB Predictions without Auto-Refresh:

[sports_predictions sport="MLB" auto_refresh="no"]

Features

  • Auto-Refresh: Predictions update automatically at specified intervals
  • Real-time Data: Fetches data directly from your API
  • Responsive Design: Looks great on all devices
  • Team Logos: Displays team logos from your taxonomy
  • Access Control: Integrates with your membership system
  • Error Handling: Falls back to cached data if API is unavailable

Technical Implementation

The plugin makes API requests in this order:

  1. First tries a GET request to the API
  2. If that fails, falls back to a POST request
  3. If both fail, uses cached data if available
  4. Caches successful responses for 5 minutes
  5. Also keeps a 24-hour "emergency cache" for API outages

Customization

Changing API Endpoint

To change the API URL, modify the SP_API_URL constant in sports-predictions.php.

Changing Cache Duration

To adjust how long predictions are cached, modify the value in the set_transient() calls in api.php.

Styling Changes

The plugin includes comprehensive styling. To customize:

  1. Add custom CSS to your theme
  2. Or edit sports-predictions.css directly

Troubleshooting

Predictions Not Updating

  • Check browser console for JavaScript errors
  • Verify API endpoint is accessible
  • Check WordPress error logs

Logos Not Showing

  • Verify team taxonomy has correct team names
  • Check that team terms have logo images attached