Skip to content

boospot/blank-custom

Repository files navigation

Custom WordPress Plugin

A comprehensive custom WordPress plugin designed for custom codes, functions, styles, scripts, and advanced REST API integrations. Built by BooSpot.com for enhanced website functionality and SEO optimization.

🚀 Features

Core Functionality

  • Custom CSS & JavaScript - Organized asset management with version control
  • Script/Style Optimization - Remove unwanted bloat and optimize performance
  • Google Tag Manager Integration - Configurable GTM implementation
  • Content Security Policy - Enhanced security headers
  • Oxygen Builder Support - Specialized functions for Oxygen Builder

REST API Integrations

  • Core REST API - Featured images and CORS headers
  • Yoast SEO Integration - Uses Yoast's native REST API fields
  • Future-Proof Design - Automatically captures new SEO plugin features

📁 File Structure

custom-plugin/
├── init.php                           # Main plugin file
├── core-rest-integration.php          # Core REST API functionality
├── bloat-remover.php                  # Script/style optimization
├── GTM.php                           # Google Tag Manager
├── oxygen-functions.php              # Oxygen Builder functions
├── csp.php                           # Content Security Policy
├── css/
│   └── style.css                     # Custom styles
├── js/
│   └── script.js                     # Custom JavaScript
└── README.md                         # This file

🛠 Installation

  1. Download the plugin files
  2. Rename folder to your website name + "-custom" (e.g., "examplewebsite-custom")
  3. Edit init.php and change the plugin name in the header
  4. Zip all files and upload to WordPress
  5. Activate the plugin in WordPress admin

⚙️ Configuration

Basic Setup

  • Plugin automatically activates all features
  • No configuration required for basic functionality

Google Tag Manager

  • Edit GTM.php file and replace GTM-XXXXX with your actual GTM ID
  • Or use WordPress options: update_option('custom_gtm_id', 'GTM-XXXXXXX');

Oxygen Builder

  • For Oxygen Builder sites, the plugin automatically loads CSS after Oxygen's styles
  • No additional configuration needed

Script/Style Optimization

  • Edit bloat-remover.php to remove unwanted scripts/styles
  • Configure specific pages, post types, or site-wide removal

🔌 REST API Features

Available Endpoints

All public post types automatically get these additional fields:

Core Fields

  • featured_image - Featured image data with dimensions and alt text

Yoast SEO Fields (if Yoast is active)

✅ RECOMMENDED: Use Yoast's Native REST API Fields

Yoast SEO provides comprehensive REST API data through its built-in fields:

  • yoast_head - Complete HTML head data
  • yoast_head_json - Structured JSON data with all SEO information
  • yoast_json_ld - JSON-LD structured data (when available)

Available Data in yoast_head_json:

  • title - SEO optimized page title
  • og_title - Open Graph title
  • og_description - Open Graph description
  • og_image - Open Graph image data
  • canonical - Canonical URL
  • robots - SEO directives
  • schema - Complete structured data (Article, WebPage, Organization, etc.)
  • twitter_card - Twitter card data
  • author - Post author information
  • article_published_time - Publication date
  • article_modified_time - Last modified date

Example API Response

{
  "id": 123,
  "title": "My Post",
  "featured_image": {
    "url": "https://example.com/image.jpg",
    "width": 1200,
    "height": 630,
    "alt": "Image description"
  },
  "yoast_head_json": {
    "title": "SEO Title - Site Name",
    "og_title": "Open Graph Title",
    "og_description": "Meta description for social sharing",
    "og_image": [
      {
        "url": "https://example.com/og-image.jpg",
        "width": 1200,
        "height": 627,
        "type": "image/jpeg"
      }
    ],
    "canonical": "https://example.com/canonical-url",
    "robots": {
      "index": "index",
      "follow": "follow"
    },
    "schema": {
      "@context": "https://schema.org",
      "@graph": [
        {
          "@type": "Article",
          "headline": "Article Title",
          "author": {
            "name": "Author Name"
          },
          "datePublished": "2023-01-01T00:00:00+00:00"
        }
      ]
    }
  }
}

⚠️ All in One SEO (AIO SEO) Integration Status

PROBLEM IDENTIFIED:

All in One SEO (AIO SEO) does NOT provide REST API data in its free version. This is a limitation of the AIO SEO plugin itself, not our custom plugin.

Why AIO SEO Integration Was Removed:

  1. Free Version Limitation: AIO SEO free version doesn't expose data via REST API
  2. ACF Bridge Issues: Attempts to create ACF fields for data exposure were problematic
  3. Data Storage Method: AIO SEO stores data in a way that's not easily accessible via REST API
  4. Maintenance Overhead: Custom integration required constant updates and debugging

RECOMMENDED SOLUTION: Use Yoast SEO

✅ Yoast SEO is the recommended choice because:

  • Native REST API Support: Built-in comprehensive REST API fields
  • No Custom Integration Needed: Works out of the box
  • Complete Data Access: All SEO data available via yoast_head_json
  • Structured Data: Full JSON-LD schema support
  • Reliable: Well-maintained and widely supported
  • Future-Proof: Automatically includes new features

For OSCP Integration:

Use Yoast's native REST API fields directly:

// Get SEO data from Yoast
const seoData = post.yoast_head_json;
const title = seoData.title;
const description = seoData.og_description;
const canonical = seoData.canonical;
const schema = seoData.schema;

🔧 Advanced Features

Security Features

  • Content Security Policy - Configurable CSP headers
  • Security Headers - X-Frame-Options, X-XSS-Protection, etc.
  • CORS Configuration - Configurable cross-origin resource sharing

Performance Optimization

  • Script Removal - Remove unwanted scripts on specific pages
  • Style Optimization - Remove unnecessary CSS
  • Asset Versioning - Automatic cache busting for CSS/JS

🎯 Use Cases

For Developers

  • Custom functionality without theme modifications
  • REST API data for headless WordPress
  • SEO data integration for custom frontends
  • Performance optimization tools

For SEO Specialists

  • Complete SEO data exposure via REST API (Yoast only)
  • Structured data integration
  • Meta data management
  • Social media optimization

For Site Owners

  • Easy GTM integration
  • Performance optimization
  • Security enhancements
  • Custom styling and functionality

🔄 Updates & Maintenance

Automatic Features

  • SEO data automatically available when Yoast is active
  • CORS headers are automatically configured
  • Performance optimizations run automatically

Manual Configuration

  • GTM ID can be changed in GTM.php
  • Script/style removal can be customized in bloat-remover.php
  • Security headers can be modified in csp.php

📞 Support

This plugin is maintained by BooSpot.com. For support or customization requests, please contact the development team.

📄 License

GPL-2.0+ - See LICENSE file for details.


Version: 1.0.2
Requires: WordPress 5.0+
Requires PHP: 7.0+
Tested up to: WordPress 6.4

🔄 Changelog

Version 1.0.2

  • Removed All in One SEO integration (incompatible with free version)
  • Removed Custom Yoast integration (redundant with native support)
  • Simplified plugin structure for better maintainability
  • Updated documentation with clear SEO plugin guidance
  • Recommended Yoast SEO as the primary SEO solution

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •