91 lines
3.2 KiB
Markdown
91 lines
3.2 KiB
Markdown
---
|
|
phase: 05-mentor-job-board
|
|
plan: 03
|
|
subsystem: media
|
|
tags: [wordpress, image-processing, acf, elementor]
|
|
requires: [01-03]
|
|
provides: [job-logo-image-size]
|
|
affects: [05-01, 05-02]
|
|
tech-stack:
|
|
added: []
|
|
patterns: [add_image_size, after_setup_theme hook]
|
|
key-files:
|
|
created: []
|
|
modified: [includes/class-post-types.php]
|
|
key-decisions:
|
|
- Registered 200x200px hard crop for consistent logo display
|
|
- Used after_setup_theme hook for proper WordPress image size registration timing
|
|
- Size name 'job-logo' accessible via standard WordPress image functions
|
|
issues-created: []
|
|
duration: 2 min
|
|
completed: 2026-01-14
|
|
---
|
|
|
|
# Phase 5 Plan 3: Logo Auto-Crop Summary
|
|
|
|
**Job logo image size registered for automatic 200x200px cropping on upload**
|
|
|
|
## Accomplishments
|
|
|
|
- Custom image size 'job-logo' registered with 200x200px hard crop
|
|
- WordPress automatically generates cropped version when logos uploaded
|
|
- Size accessible via wp_get_attachment_image() and wp_get_attachment_image_src()
|
|
- Elementor templates can use 'job-logo' size for consistent display
|
|
|
|
## Files Created/Modified
|
|
|
|
- `includes/class-post-types.php` - Added register_image_sizes() method with after_setup_theme hook
|
|
|
|
## Technical Details
|
|
|
|
### Image Size Registration
|
|
|
|
The `register_image_sizes()` method registers a custom image size:
|
|
- **Name:** 'job-logo'
|
|
- **Dimensions:** 200x200px (width, height)
|
|
- **Hard crop:** true (ensures square crop from center, no stretching)
|
|
- **Hook:** after_setup_theme (priority 10, standard WordPress timing)
|
|
|
|
### Integration Points
|
|
|
|
1. **ACF Integration** - The job_logo field (from Phase 01-03) returns attachment ID, enabling access to all registered image sizes
|
|
2. **Elementor Templates** - Can request 'job-logo' size in Loop Grid or Posts widgets for archive/detail pages
|
|
3. **WordPress Functions** - Accessible via:
|
|
- `wp_get_attachment_image($logo_id, 'job-logo')`
|
|
- `wp_get_attachment_image_src($logo_id, 'job-logo')`
|
|
|
|
## Decisions Made
|
|
|
|
1. **200x200px hard crop** - Ensures consistent square display regardless of upload dimensions. Prevents layout issues in Elementor templates caused by varying aspect ratios.
|
|
|
|
2. **after_setup_theme hook** - Standard WordPress timing for image size registration. Ensures size is available before WordPress processes image uploads.
|
|
|
|
3. **Size name 'job-logo'** - Descriptive name that clearly indicates purpose. Follows WordPress conventions (lowercase with hyphen separator).
|
|
|
|
## Commits
|
|
|
|
- Task 1: `c8b911b` - feat(05-03): register 200x200px cropped image size for job logos
|
|
|
|
## Verification
|
|
|
|
All verification criteria met:
|
|
|
|
- Image size 'job-logo' registered via add_image_size()
|
|
- Dimensions are 200x200px with hard crop enabled (true parameter)
|
|
- Hook registered for after_setup_theme action
|
|
- Method properly called from class initialization (register() method)
|
|
|
|
## Issues Encountered
|
|
|
|
None
|
|
|
|
## Next Step
|
|
|
|
Phase 5 complete. All 4 plans done:
|
|
- 05-01: Job archive Elementor template with access control (completed in parallel)
|
|
- 05-02: Job detail Elementor template with ACF fields (completed in parallel)
|
|
- 05-03: Logo auto-crop to 200x200px (completed)
|
|
- 05-04: Apply popup form with email notification (completed in parallel)
|
|
|
|
Ready for Phase 6: Email Notifications (mentor opt-in and async processing).
|