Overview
The VertiSub theme is tightly integrated with Advanced Custom Fields (ACF) for flexible content management. All field configurations are synchronized via JSON files in theacf-json/ directory for version control and deployment.
ACF JSON Sync
ACF field groups are stored as JSON files for easy version control and deployment.JSON File Location
How JSON Sync Works
- Automatic Export: When you save a field group in WordPress admin, ACF automatically exports it to JSON
- Version Control: Commit JSON files to Git for tracking changes
- Automatic Import: On other environments, ACF detects and imports JSON files
Benefits
- Version Control: Track field changes in Git
- Easy Deployment: Copy JSON files between environments
- Team Collaboration: Share field configurations
- Backup: JSON files serve as field group backups
Utility Function
The theme provides a wrapper function for ACF field access:vertisub_get_acf_field()
File:inc/utils.php
Usage Examples
Why Use This Function?
- Plugin Detection: Checks if ACF is active
- Fallback: Returns empty string if ACF is missing
- Consistency: Standardized field access across theme
- Options Support: Easy access to options page fields
Common Field Types
Repeater Fields
Used for repeating content like banners, projects, or team members.Banner Repeater Example
Projects Repeater Example
Group Fields
Organize related fields together.Solutions Group Example
Hero Group Example
Image Fields
Store and display images.Gallery Fields
Multiple images in a gallery.True/False Fields
Conditional display control.URL Fields
Store links and external URLs.Relationship Fields
Link to other posts/pages.Field Locations
ACF fields can be assigned to different locations:Page Templates
Fields specific to page templates:templates/home-template.php:
- banners
- soluciones
- proyectos
- novedades
Post Types
Fields for custom post types:Options Pages
Global site settings:Best Practices
1. Always Check Field Existence
2. Escape All Output
3. Provide Fallbacks
4. Use Descriptive Field Names
Good:hero_background_imagecourse_enrollment_urlservice_gallery_images
image1linktext
5. Group Related Fields
6. Document Complex Structures
For repeaters with multiple subfields, add field instructions:Common Patterns
Conditional Section Display
Nested Repeaters
Image with Fallback
Troubleshooting
Fields Not Appearing
- Check ACF is Active: Verify Advanced Custom Fields plugin is installed and activated
- Check Location Rules: Ensure field group location rules match your page/template
- Clear Cache: Clear any caching plugins
- Check JSON Sync: Ensure
acf-json/directory is writable (755 permissions)
Empty Field Values
JSON Sync Issues
- Make acf-json Writable:
chmod 755 wp-content/themes/vertisubtheme/acf-json/ - Check JSON Files: Verify JSON files exist and are valid
- Force Sync: Go to ACF > Sync Available and sync field groups
Advanced Techniques
Creating ACF Blocks
For Gutenberg block editor integration:Dynamic Field Loading
Load fields based on other field values:Related Documentation
- Theme Architecture - Overall theme structure
- Template System - Using ACF in templates
- Custom Post Types - ACF fields for CPTs

