Skip to content

Commit 329906f

Browse files
kiransbsfclaude
andcommitted
docs(internal): add internal documentation
- README.md: project overview and doc index - architecture.md: plugin architecture and request lifecycle - codebase-map.md: directory structure and key files - ai-agent-guide.md: patterns and checklist for AI-assisted development Optimized for developer onboarding and AI agent understanding. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d279903 commit 329906f

4 files changed

Lines changed: 121 additions & 0 deletions

File tree

internal-docs/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Fullwidth Page Templates — Internal Documentation
2+
3+
> Auto-generated documentation for developer onboarding and AI agent understanding.
4+
5+
## Quick Facts
6+
7+
| Key | Value |
8+
|-----|-------|
9+
| **Plugin Name** | Fullwidth Page Templates |
10+
| **Version** | 1.2.0 |
11+
| **Text Domain** | fullwidth-templates |
12+
| **Main File** | `fullwidth-page-template.php` |
13+
| **PHP Files** | 13 |
14+
| **Build Tool** | Grunt |
15+
| **Stack** | WordPress Plugin (PHP) |
16+
17+
## Description
18+
19+
Create full-width landing pages with any theme using page builder templates.
20+
21+
## Index
22+
23+
- [Architecture](architecture.md) — High-level architecture and data flow
24+
- [Codebase Map](codebase-map.md) — Directory structure and key files
25+
- [AI Agent Guide](ai-agent-guide.md) — Key patterns and locations for AI-assisted development

internal-docs/ai-agent-guide.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# AI Agent Guide — Fullwidth Page Templates
2+
3+
## Quick Start for AI Agents
4+
5+
1. **Entry point:** Start at `fullwidth-page-template.php` to understand plugin initialization
6+
2. **Constants:** Look for `define()` calls in the main file for paths and versions
7+
3. **Hook registration:** Search for `add_action` and `add_filter` to find where functionality is attached
8+
4. **Text domain:** Use `fullwidth-templates` for all translatable strings
9+
10+
## Common Tasks
11+
12+
### Adding a new feature
13+
1. Create a new class file in the appropriate directory
14+
2. Register it via `require_once` in the loader or main class
15+
3. Use `add_action`/`add_filter` to hook into WordPress
16+
4. Follow existing class patterns for consistency
17+
18+
### Modifying existing behavior
19+
1. Find the relevant class by searching for the hook or function name
20+
2. Check for filters that allow modification without editing core files
21+
3. If editing, maintain the existing code style and patterns
22+
23+
### Adding translatable strings
24+
1. Wrap strings in `__( 'text', 'fullwidth-templates' )` or `esc_html__( 'text', 'fullwidth-templates' )`
25+
2. Run `npx grunt i18n` to update the POT file
26+
27+
## WordPress Checklist
28+
29+
- [ ] All output is escaped (`esc_html`, `esc_attr`, `esc_url`, `wp_kses`)
30+
- [ ] All input is sanitized (`sanitize_text_field`, `absint`, etc.)
31+
- [ ] Nonces used for forms and AJAX (`wp_nonce_field`, `check_ajax_referer`)
32+
- [ ] Capability checks before privileged operations (`current_user_can`)
33+
- [ ] Text domain `fullwidth-templates` used for all user-facing strings
34+
- [ ] No direct file access (files start with `defined( 'ABSPATH' )` check or silence)
35+
36+
## Pitfalls
37+
38+
- Plugin may depend on Astra theme being active — check for theme dependency logic
39+
- Constants are defined only once — don't redefine them
40+
- Follow WordPress coding standards (spaces not tabs for alignment, tabs for indentation)

internal-docs/architecture.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Architecture — Fullwidth Page Templates
2+
3+
## Overview
4+
5+
Fullwidth Page Templates is a WordPress plugin that follows standard WordPress plugin architecture patterns.
6+
7+
## Entry Point
8+
9+
The plugin entry point is `fullwidth-page-template.php`, which:
10+
1. Defines plugin constants (version, file path, base name, directory, URI)
11+
2. Loads the main plugin class via a WordPress hook (`after_setup_theme` or `plugins_loaded`)
12+
13+
## Request Lifecycle
14+
15+
1. WordPress loads the plugin via `fullwidth-page-template.php`
16+
2. Constants are defined for use throughout the plugin
17+
3. Main class is instantiated/loaded on the appropriate hook
18+
4. Classes register their own hooks and filters
19+
5. Frontend/admin output is rendered when WordPress fires the relevant hooks
20+
21+
## Key Patterns
22+
23+
- **Hook-based architecture:** All functionality is attached via `add_action()` and `add_filter()`
24+
- **Class autoloading:** Classes are loaded via `require_once` in the main plugin file or loader class
25+
- **Separation of concerns:** Admin and frontend code are separated into different classes/directories
26+
- **WordPress Customizer integration:** Settings are registered via the Customizer API where applicable
27+
28+
## Dependencies
29+
30+
- WordPress core (required)
31+
- Astra theme (recommended/required for full functionality)
32+
- No external PHP dependencies beyond WordPress

internal-docs/codebase-map.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Codebase Map — Fullwidth Page Templates
2+
3+
## Directory Structure
4+
5+
```
6+
fullwidth-templates/
7+
├── fullwidth-page-template.php # Plugin entry point
8+
├── admin/bsf-analytics/class-bsf-analytics-loader.php
9+
├── admin/bsf-analytics/class-bsf-analytics-stats.php
10+
├── admin/bsf-analytics/class-bsf-analytics.php
11+
├── admin/notices/class-astra-notices.php
12+
├── class-fullwidth-page-templates.php
13+
├── fullwidth-page-template.php
14+
├── templates/default/template-helpers.php
15+
├── templates/default/template-page-builder-no-header-footer.php
16+
├── templates/default/template-page-builder-no-sidebar.php
17+
├── templates/default/template-page-builder.php
18+
├── .distignore # WordPress.org distribution exclusions
19+
├── .gitignore # Git exclusions
20+
├── Gruntfile.js # Grunt build configuration
21+
├── package.json # Node.js dependencies
22+
├── CLAUDE.md # Claude Code project context
23+
└── .claude/settings.json # Claude Code tool permissions
24+
```

0 commit comments

Comments
 (0)