-
Notifications
You must be signed in to change notification settings - Fork 0
WordPress Integration
Learn how to integrate the Accessibility Widget (Web Plugin) into your WordPress site.
Note: This guide covers integrating the web plugin into WordPress. A dedicated WordPress plugin version is in development and will be available soon.
This is the recommended method for WordPress themes.
Upload these files to your WordPress theme directory:
accessibility-plugin.jsaccessibility-plugin.css-
accessibility-config.js(optional)
Location: /wp-content/themes/your-theme-name/
Add this code to your theme's functions.php file:
function add_accessibility_plugin() { // Enqueue Boxicons (required) wp_enqueue_style( 'boxicons', 'https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css', array(), '2.1.4' ); // Enqueue plugin CSS wp_enqueue_style( 'accessibility-plugin', get_template_directory_uri() . '/accessibility-plugin.css', array(), '1.0.0' ); // Enqueue config (optional) wp_enqueue_script( 'accessibility-config', get_template_directory_uri() . '/accessibility-config.js', array(), '1.0.0', false // Load in header ); // Enqueue plugin JS (must be last) wp_enqueue_script( 'accessibility-plugin', get_template_directory_uri() . '/accessibility-plugin.js', array(), '1.0.0', true // Load in footer ); } add_action('wp_enqueue_scripts', 'add_accessibility_plugin');
- Clear WordPress cache (if using caching plugin)
- Visit your website
- Check that the widget appears
If you prefer not to host the files, use the CDN version:
function add_accessibility_plugin() { // Enqueue Boxicons wp_enqueue_style( 'boxicons', 'https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css', array(), '2.1.4' ); // Enqueue plugin CSS from CDN wp_enqueue_style( 'accessibility-plugin', 'https://cdn.jsdelivr.net/npm/website-accessibility-filter@latest/accessibility-plugin.css', array(), null // CDN handles versioning ); // Enqueue plugin JS from CDN (must be last) wp_enqueue_script( 'accessibility-plugin', 'https://cdn.jsdelivr.net/npm/website-accessibility-filter@latest/accessibility-plugin.js', array(), null, true // Load in footer ); } add_action('wp_enqueue_scripts', 'add_accessibility_plugin');
Create a simple WordPress plugin to add the accessibility widget.
Create a new file: accessibility-widget-plugin.php
<?php /** * Plugin Name: Accessibility Widget * Plugin URI: https://github.com/airforcerp/Website-Accessibility-Widget * Description: Adds accessibility features to your WordPress site * Version: 1.0.0 * Author: AirforceRP * License: Free */ function accessibility_widget_enqueue() { // Enqueue Boxicons wp_enqueue_style( 'boxicons', 'https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css', array(), '2.1.4' ); // Enqueue plugin CSS wp_enqueue_style( 'accessibility-plugin', plugin_dir_url(__FILE__) . 'accessibility-plugin.css', array(), '1.0.0' ); // Enqueue plugin JS wp_enqueue_script( 'accessibility-plugin', plugin_dir_url(__FILE__) . 'accessibility-plugin.js', array(), '1.0.0', true ); } add_action('wp_enqueue_scripts', 'accessibility_widget_enqueue');
- Create folder:
/wp-content/plugins/accessibility-widget/ - Add the PHP file and plugin files to this folder
- Activate the plugin in WordPress admin
Edit accessibility-config.js:
var AccessibilityConfig = { position: 'bottom-left', // or 'bottom-right' // ... other settings };
Add custom CSS to your theme:
/* In your theme's style.css or custom CSS */ .accessibility-toggle-btn { background: #0073aa; /* WordPress blue */ } .accessibility-panel-header { background: #0073aa; }
-
Clear Cache
- Clear WordPress cache
- Clear browser cache
- Disable caching plugins temporarily
-
Check File Paths
- Verify file paths in
functions.php - Check that files exist in theme directory
- Use
get_template_directory_uri()for parent themes - Use
get_stylesheet_directory_uri()for child themes
- Verify file paths in
-
Check Script Loading
- Ensure scripts load in correct order
- Plugin JS must load last
- Check browser console for errors
-
Test with Default Theme
- Switch to default WordPress theme
- Test if widget appears
- If yes, issue is theme-specific
-
Disable Other Plugins
- Disable plugins one by one
- Test after each disable
- Find conflicting plugin
-
Check JavaScript Errors
- Open browser console (F12)
- Look for errors
- Fix or report errors
If using a child theme, use get_stylesheet_directory_uri():
wp_enqueue_style( 'accessibility-plugin', get_stylesheet_directory_uri() . '/accessibility-plugin.css', array(), '1.0.0' );
-
Use CDN for Production
- Better caching
- Faster loading
- Less server load
-
Version Control
- Use specific versions in production
- Test updates before deploying
- Keep backups
-
Performance
- Load scripts in footer
- Use async/defer if needed
- Minimize custom CSS
-
Testing
- Test on staging site first
- Test with different themes
- Test with different plugins
- Check Troubleshooting guide
- Review FAQ
- Open issue on GitHub
- Installation Guide - Step-by-step installation instructions
- Quick Start Guide - Get up and running in 5 minutes
- Configuration Guide - Customize the plugin to your needs
- Features Overview - Complete list of all features
- JavaScript API - Programmatic control documentation
- Browser Compatibility - Supported browsers and features
- WordPress Integration - How to integrate with WordPress
- Customization Guide - Styling and theming
- Advanced Usage - Tips and tricks for power users
- Contributing - How to contribute to the project
- Development Setup - Set up your development environment
- Architecture - Understanding the codebase
- Troubleshooting - Common issues and solutions
- FAQ - Frequently asked questions
- Known Issues - Current limitations and workarounds