{"id":27919351,"url":"https://github.com/wpgaurav/gt-acf-blocks","last_synced_at":"2026-04-27T18:03:38.219Z","repository":{"id":291500911,"uuid":"977815740","full_name":"wpgaurav/gt-acf-blocks","owner":"wpgaurav","description":"GT ACF Blocks simplifies the process of creating custom Gutenberg blocks for WordPress by leveraging the power of Advanced Custom Fields. This plugin allows developers to quickly build rich, customizable blocks with clean, organized code and without having to write complex JavaScript.","archived":false,"fork":false,"pushed_at":"2025-05-15T04:32:06.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-25T23:05:13.952Z","etag":null,"topics":["acf","acf-field","acf-pro","advanced-custom-fields","block-editor","gutenberg","gutenberg-blocks","wordpress","wordpress-development","wordpress-plugin"],"latest_commit_sha":null,"homepage":"https://gauravtiwari.org/code/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wpgaurav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-05T02:25:19.000Z","updated_at":"2025-05-15T04:32:10.000Z","dependencies_parsed_at":"2025-06-25T23:05:15.218Z","dependency_job_id":"2c6c27e5-f401-4690-a057-f1a0533a85ee","html_url":"https://github.com/wpgaurav/gt-acf-blocks","commit_stats":null,"previous_names":["wpgaurav/gt-acf-blocks"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wpgaurav/gt-acf-blocks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpgaurav%2Fgt-acf-blocks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpgaurav%2Fgt-acf-blocks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpgaurav%2Fgt-acf-blocks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpgaurav%2Fgt-acf-blocks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wpgaurav","download_url":"https://codeload.github.com/wpgaurav/gt-acf-blocks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wpgaurav%2Fgt-acf-blocks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32348058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T17:12:42.749Z","status":"ssl_error","status_checked_at":"2026-04-27T17:12:41.658Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acf","acf-field","acf-pro","advanced-custom-fields","block-editor","gutenberg","gutenberg-blocks","wordpress","wordpress-development","wordpress-plugin"],"created_at":"2025-05-06T19:16:54.313Z","updated_at":"2026-04-27T18:03:38.197Z","avatar_url":"https://github.com/wpgaurav.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GT ACF Blocks\n\nA WordPress plugin that provides a framework for easily creating custom Gutenberg blocks using Advanced Custom Fields (ACF).\n\n## Description\n\nGT ACF Blocks simplifies the process of creating custom Gutenberg blocks for WordPress by leveraging the power of Advanced Custom Fields. This plugin allows developers to quickly build rich, customizable blocks with clean, organized code and without having to write complex JavaScript.\n\n## Features\n\n- Simple framework for registering custom Gutenberg blocks\n- Seamless integration with Advanced Custom Fields\n- Block templates with automatic field rendering\n- Block categories for organization\n- Block preview support\n- CSS and JS enqueuing for individual blocks\n- Developer-friendly API\n\n## Requirements\n\n- WordPress 5.8+\n- PHP 7.4+\n- Advanced Custom Fields PRO 5.8+\n\n## Installation\n\n1. Upload the `gt-acf-blocks` folder to the `/wp-content/plugins/` directory\n2. Activate the plugin through the 'Plugins' menu in WordPress\n3. Ensure Advanced Custom Fields PRO is installed and activated\n\n## Usage\n\n### Creating a New Block\n\n1. Create a new folder for your block in the `blocks` directory\n2. Add your block's PHP, CSS, and JS files\n3. Register your block using the plugin's API\n\n### Basic Block Structure\n\n```\nblocks/\n└── example-block/\n    ├── block.json       # Block configuration\n    ├── block.php        # Block template\n    ├── block.css        # Block styles (optional)\n    ├── block.js         # Block scripts (optional)\n    └── fields.php       # ACF field definitions\n```\n\n### Registering a Block\n\nAdd your block registration to your theme's `functions.php` or a custom plugin:\n\n```php\nadd_action('acf/init', 'register_my_blocks');\n\nfunction register_my_blocks() {\n    if (function_exists('gt_acf_blocks_register_block')) {\n        gt_acf_blocks_register_block([\n            'name'        =\u003e 'example-block',\n            'title'       =\u003e 'Example Block',\n            'description' =\u003e 'An example custom block',\n            'category'    =\u003e 'formatting',\n            'keywords'    =\u003e ['example', 'demo'],\n        ]);\n    }\n}\n```\n\n## Adding a New Block\n\nFollow these steps to create and register a new custom block:\n\n1. **Create the block directory structure**:\n   ```\n   cd /path/to/your/wordpress/wp-content/plugins/gt-acf-blocks/blocks\n   mkdir my-custom-block\n   ```\n\n2. **Create the necessary files**:\n   - `block.json` - Block configuration\n   - `block.php` - Block template\n   - `fields.php` - ACF field definitions\n   - `block.css` (optional) - Block styles\n   - `block.js` (optional) - Block scripts\n\n3. **Configure your block.json**:\n   ```json\n   {\n     \"name\": \"my-custom-block\",\n     \"title\": \"My Custom Block\",\n     \"description\": \"A description of what my block does\",\n     \"category\": \"formatting\",\n     \"icon\": \"star-filled\",\n     \"keywords\": [\"custom\", \"example\"],\n     \"acf\": {\n       \"mode\": \"preview\",\n       \"renderTemplate\": \"block.php\"\n     },\n     \"supports\": {\n       \"align\": true,\n       \"mode\": false,\n       \"jsx\": false\n     }\n   }\n   ```\n\n4. **Define your ACF fields in fields.php**:\n   ```php\n   \u003c?php\n   if (function_exists('acf_add_local_field_group')) {\n       acf_add_local_field_group([\n           'key' =\u003e 'group_my_custom_block',\n           'title' =\u003e 'My Custom Block',\n           'fields' =\u003e [\n               [\n                   'key' =\u003e 'field_my_custom_field',\n                   'label' =\u003e 'Custom Field',\n                   'name' =\u003e 'custom_field',\n                   'type' =\u003e 'text',\n               ],\n           ],\n           'location' =\u003e [\n               [\n                   [\n                       'param' =\u003e 'block',\n                       'operator' =\u003e '==',\n                       'value' =\u003e 'acf/my-custom-block',\n                   ],\n               ],\n           ],\n       ]);\n   }\n   ```\n\n5. **Create your block template in block.php**:\n   ```php\n   \u003c?php\n   /**\n    * Block Template\n    */\n   \n   // Get field values\n   $custom_field = get_field('custom_field');\n   ?\u003e\n   \n   \u003cdiv id=\"\u003c?php echo esc_attr($block['id']); ?\u003e\" class=\"my-custom-block\"\u003e\n       \u003c?php if ($custom_field): ?\u003e\n           \u003cdiv class=\"custom-content\"\u003e\n               \u003c?php echo esc_html($custom_field); ?\u003e\n           \u003c/div\u003e\n       \u003c?php endif; ?\u003e\n   \u003c/div\u003e\n   ```\n\n6. **Register your block** in your theme's functions.php or a custom plugin:\n   ```php\n   add_action('acf/init', 'register_my_blocks');\n   \n   function register_my_blocks() {\n       if (function_exists('gt_acf_blocks_register_block')) {\n           gt_acf_blocks_register_block([\n               'name' =\u003e 'my-custom-block',\n           ]);\n       }\n   }\n   ```\n\n7. **Add CSS (optional)** in block.css:\n   ```css\n   .my-custom-block {\n       padding: 20px;\n       background-color: #f8f8f8;\n   }\n   \n   .my-custom-block .custom-content {\n       font-size: 18px;\n       color: #333;\n   }\n   ```\n\n8. **Add JavaScript (optional)** in block.js:\n   ```javascript\n   (function($) {\n       $(document).ready(function() {\n           $('.my-custom-block').on('click', function() {\n               // Your custom JavaScript here\n           });\n       });\n   })(jQuery);\n   ```\n\n9. **Test your block** by adding it to a page or post in the WordPress editor.\n\n## Configuration\n\nEach block can be configured through its `block.json` file with the following options:\n\n- `name`: Internal block name (required)\n- `title`: Display title in the editor (required)\n- `description`: Block description\n- `category`: Block category\n- `icon`: Dashicon or SVG to represent the block\n- `keywords`: Search terms to help users discover the block\n- `supports`: Block support options\n- `example`: Preview example configuration\n\n## Development\n\n### Field Definitions\n\nDefine your ACF fields in the block's `fields.php` file:\n\n```php\n\u003c?php\nif (function_exists('acf_add_local_field_group')) {\n    acf_add_local_field_group([\n        'key' =\u003e 'group_example_block',\n        'title' =\u003e 'Example Block',\n        'fields' =\u003e [\n            [\n                'key' =\u003e 'field_example_title',\n                'label' =\u003e 'Title',\n                'name' =\u003e 'title',\n                'type' =\u003e 'text',\n            ],\n            // Add more fields as needed\n        ],\n        'location' =\u003e [\n            [\n                [\n                    'param' =\u003e 'block',\n                    'operator' =\u003e '==',\n                    'value' =\u003e 'acf/example-block',\n                ],\n            ],\n        ],\n    ]);\n}\n```\n\n### Block Template\n\nCreate your block's front-end display in the `block.php` file:\n\n```php\n\u003c?php\n/**\n * Block Template\n * \n * @param array $block The block settings and attributes\n * @param string $content The block content\n * @param bool $is_preview Whether this is a preview in the editor\n */\n\n// Get field values\n$title = get_field('title');\n?\u003e\n\n\u003cdiv id=\"\u003c?php echo esc_attr($block['id']); ?\u003e\" class=\"example-block\"\u003e\n    \u003c?php if ($title): ?\u003e\n        \u003ch2\u003e\u003c?php echo esc_html($title); ?\u003e\u003c/h2\u003e\n    \u003c?php endif; ?\u003e\n\u003c/div\u003e\n```\n\n## Support\n\nFor support, feature requests, or bug reports, please submit an issue via the GitHub repository or [send me a message](https://gauravtiwari.org).\n\n## License\n\nThis plugin is licensed under the GPL v2 or later.\n\n---\n\nBuilt with ♥ by [Gaurav Tiwari](https://gauravtiwari.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpgaurav%2Fgt-acf-blocks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwpgaurav%2Fgt-acf-blocks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwpgaurav%2Fgt-acf-blocks/lists"}