G&M Dev Tools π οΈ self-updates
G&M Dev Tool Wordpress Plugin
by Eric Downs - Grain & Mortar Β· github.com/grainandmortar/gm-dev-tools Β· website
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/grainandmortar/gm-dev-tools/archive/refs/heads/main.zipShips its own WordPress updater (built-in updater), so new versions show up under Dashboard β Updates.
Professional WordPress development tools for debugging and visualizing themes.
Features
π Outline Toggle
Visual element outlines for layout debugging. Cycles through:
- Off - No outlines
- Divs Only - Shows only div elements
- All Elements - Shows all HTML elements
π Typography Inspector
Progressive typography information with 4 detail levels:
- Off - No labels
- Tags - Shows element tags (H1, H2, P, etc.)
- Fonts - Shows tags + font family (e.g.,
H1 β’ Bembo MT Pro) - Full - Complete details (e.g.,
H1 β’ Bembo MT Pro β’ 32px/120% β’ Bold β’ #333333)
π·οΈ Module Labels
Displays module names on the frontend for easy identification. Works with:
- ACF Flexible Content modules
- Custom theme modules
- Any data-attribute based modules
Installation
Method 1: Direct Download
- Download the latest release from GitHub
- Upload to
/wp-content/plugins/directory - Activate through the 'Plugins' menu in WordPress
Method 2: Git Clone
cd wp-content/plugins/
git clone https://github.com/grainandmortar/gm-dev-tools.git
Method 3: Symlink for Development
# Clone to your development directory
git clone https://github.com/grainandmortar/gm-dev-tools.git ~/Local\ Sites/wordpress-plugins/gm-dev-tools
# Create symlink in your WordPress installation
ln -s ~/Local\ Sites/wordpress-plugins/gm-dev-tools /path/to/wordpress/wp-content/plugins/gm-dev-tools
Usage
Once activated, the tools appear in the bottom-right corner of your site:
- Click the βοΈ toggle button to show/hide the tool panel
- Click any tool button to activate/deactivate it
- Tools remember their state using localStorage
Keyboard Shortcuts
- Outline Toggle:
Ctrl/Cmd + Shift + O - Typography Inspector:
Ctrl/Cmd + Shift + T - Module Labels:
Ctrl/Cmd + Shift + M
Module Labels Configuration π
The Module Labels tool can be customized for any theme by adding a configuration file. This allows the plugin to work with any module naming convention without modifying the plugin code.
Default Behavior
By default, the Module Labels tool looks for ACF modules with data-acf-module attributes.
Custom Configuration
To use custom module attributes (like data-module or data-component), add a configuration file to your theme root:
File: your-theme/gm-dev-tools-config.php
<?php
/**
* GM Dev Tools Configuration
* Theme-specific settings for GM Dev Tools plugin
*/
return array(
'module_labels' => array(
// CSS selector to find modules
'selector' => '[data-module]',
// The data attribute name (without 'data-' prefix)
'attribute' => 'module',
// Optional: Prefix to remove from module names when displaying
// Example: 'page_module_home_hero' becomes 'home_hero'
'format_prefix' => 'page_module_',
// Optional: Additional class selectors
'class_selectors' => array(),
// Optional: Custom format function name
'format_function' => null,
)
);
Configuration Examples
Example 1: Standard ACF Modules
// No configuration needed - uses defaults
// Looks for: data-acf-module="hero_banner"
Example 2: Custom Data Attributes
return array(
'module_labels' => array(
'selector' => '[data-component]',
'attribute' => 'component',
'format_prefix' => 'component_',
)
);
// Looks for: data-component="component_header"
Example 3: Class-Based Modules
return array(
'module_labels' => array(
'selector' => '.module',
'attribute' => null,
'class_selectors' => array('.module', '.component'),
)
);
// Looks for: <div class="module">
Module Preparation
For the Module Labels tool to work, your theme's modules need identifiable attributes:
<!-- ACF Module (default) -->
<div data-acf-module="hero_banner">
<!-- module content -->
</div>
<!-- Custom Module -->
<div data-module="page_module_home_hero">
<!-- module content -->
</div>
<!-- With HTML comment for source viewing -->
<!-- MODULE: page_module_home_hero -->
<div data-module="page_module_home_hero">
<!-- module content -->
</div>
Requirements
- WordPress 5.0 or higher
- PHP 7.0 or higher
- Modern browser with JavaScript enabled
Updates
The plugin includes automatic update checking from GitHub releases. When a new version is available, you'll see an update notification in your WordPress admin.
Development
Directory Structure
gm-dev-tools/
βββ admin/ # Admin interface
βββ assets/ # Shared CSS/JS for tool dock
βββ includes/ # Core classes
βββ tools/ # Individual tools
β βββ outline-toggle/
β βββ font-xray/ # Typography Inspector
β βββ acf-module-labels/ # Module Labels
βββ gm-dev-tools.php # Main plugin file
βββ gm-dev-tools-config-example.php # Example config (copy to theme)
βββ README.md
Adding New Tools
- Create a new directory in
/tools/your-tool-name/ - Create a class extending
GM_Dev_Tool - Register in
gm-dev-tools.php
Creating a Release
-
Update version number in:
gm-dev-tools.php(header comment andGM_DEV_TOOLS_VERSIONconstant)readme.txtCHANGELOG.md
-
Commit changes:
git add . git commit -m "Release version X.X.X" git push origin main -
Create GitHub release:
./create-release.sh
Support
- Issues: GitHub Issues
- Website: Grain & Mortar
License
GPL v2 or later
Built with β€οΈ by Grain & Mortar