{"id":23228978,"url":"https://github.com/mrwweb/acf-helper-functions","last_synced_at":"2025-08-19T15:30:59.579Z","repository":{"id":11720696,"uuid":"14241769","full_name":"mrwweb/acf-helper-functions","owner":"mrwweb","description":"A powerful set of functions for outputting common markup patterns with Advanced Custom Fields Plugin for WordPress.","archived":false,"fork":false,"pushed_at":"2014-03-24T22:16:24.000Z","size":144,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-19T13:26:05.981Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrwweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-11-08T19:03:27.000Z","updated_at":"2025-02-24T10:06:08.000Z","dependencies_parsed_at":"2022-09-10T20:01:36.714Z","dependency_job_id":null,"html_url":"https://github.com/mrwweb/acf-helper-functions","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mrwweb/acf-helper-functions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrwweb%2Facf-helper-functions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrwweb%2Facf-helper-functions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrwweb%2Facf-helper-functions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrwweb%2Facf-helper-functions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrwweb","download_url":"https://codeload.github.com/mrwweb/acf-helper-functions/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrwweb%2Facf-helper-functions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271176121,"owners_count":24712329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-12-19T01:15:48.593Z","updated_at":"2025-08-19T15:30:59.263Z","avatar_url":"https://github.com/mrwweb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ACF Output Helper Functions\n\nA powerful set of functions for outputting common markup patterns with [Advanced Custom Fields Plugin](http://wordpress.org/plugins/advanced-custom-fields/) for WordPress.\n\nFormerly [a gist](https://gist.github.com/mrwweb/5768363). Intial [ACF Forums discussion](http://old.support.advancedcustomfields.com/discussion/comment/19680).\n\n## OVERVIEW\n\nTwo simple functions: `get_acf_field()` and `the_acf_field()`, the latter of which is just a simple wrapper function.\n\nThe functions let you replace this:\n\n```php\n\u003c?php\n$my_field = get_field('my_field');\nif( $my_field ) {\n  echo '\u003cspan class=\"label\"\u003eMy Field:\u003c/span\u003e \u003cspan itemprop=\"name\"\u003e' . $my_field . '\u003c/span\u003e';\n}\n?\u003e\n```\n\nWith this:\n\n```php\n\u003c?php the_acf_field( 'my_field', array( 'label' =\u003e 'My Field', 'itemprop' =\u003e 'name' ); ?\u003e\n```\n\n## WHY?\n\nIt gets annoying to repeat so much code to output a simple ACF field. You have to test if the field is there, add a label, add schema.org markup, etc. This tries to help take care of some of the most common and repetitive output patterns.\n\n## ARGUMENTS\n\nThe `$args` parameter accepts an `array` or query_string-style format.\n \nArray Format:\n \n`array( 'type' =\u003e 'text', 'label' =\u003e 'a label' );`\n \nQuery String Format:\n \n`type=text\u0026label=a label`\n \n### Argument Documentation\n\n`type` Valid types:\n\n * `text` **(default)**\n * `image` (field store ID)\n * `email` (outputs as `mailto:` link, uses `link_label` arg if provided)\n * `url` (won't display field if equal to 'http://')\n * `link` (same as URL, but output as link and with optional `link_label` arg)\n * `date` (must be stored as stored as recommended yymmdd format)\n * `post_list` (a delimited list of posts selected with a relationship field)\n * `term` (a single term from a taxonomy, assumes ID is stored)\n * `term_link` (link to a term archive from a taxonomy, assumed ID is stored)\n * `custom` (use the `return_get_acf_field` filter to add more types)\n\n`label` Puts label before field output. Label wrapped in a `\u003cspan\u003e`\n\n`link_label` Anchor text for `link` or `email` field types.\n\n`image_size` only used with `'type' =\u003e 'image'`\n\n`image_class` only used with `'type' =\u003e 'image'`\n\n`itemprop` Wraps field value in `\u003cspan\u003e` with the specified schema.org property\n\n`date_format` PHP date format to return. *only used with `'type' =\u003e 'date'`*\n\n`before` HTML before the field out\n\n`after` HTML after the field output\n\n`sub_field` Set to `true` if using `get_acf_field` in a repeater or flexible field\n\n`list_sep` Delimiter string for `post_list` type\n\n`list_links` Should the `post_list` items link to posts? Default: `true`\n\n`list_type` Format that relationship field uses to store data. Default: 'objects'\n\n`taxonomy` Taxonomy containing the term. Requried for `term` field.\n\n## TO-DOS\n\n* Add more types (suggestions welcome)\n* Add sanitization\n* Complete support for `itemprop`\n\n## CHANGELOG\n\n### 13 Jun 2013\n\n * Added changelog\n * [new] filter to add new types: `return_get_acf_field`\n    * (thanks @wells5609: https://gist.github.com/wells5609/5786376)\n * [new] filter for label class: `get_acf_field_label_class`\n\n### 28 Jun 2013\n * [new] post_list type\n * [new] date type\n * [new] `sub_field` argument for use in `while( has_sub_field() ) ...`\n \n### 11 Jul 2013\n * [new] term and term_link types added for taxonomy fields for a single term\n\n### 9 Nov 2013\n * [improvement] More consistent, cleaner handling of `itemprop` arg. (Shifting to use of `sprintf`.)\n * [new] `link_label` argument for `email` and `link` field types.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrwweb%2Facf-helper-functions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrwweb%2Facf-helper-functions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrwweb%2Facf-helper-functions/lists"}