├── messages.json ├── acf_snippets ├── get_field.sublime-snippet ├── the_field.sublime-snippet ├── get_sub_field.sublime-snippet ├── the_sub_field.sublime-snippet ├── if_get_field.sublime-snippet ├── if_the_field.sublime-snippet ├── get_field_options.sublime-snippet ├── the_field_options.sublime-snippet ├── if_get_sub_field.sublime-snippet ├── if_the_sub_field.sublime-snippet ├── get_sub_field_options.sublime-snippet ├── the_sub_field_options.sublime-snippet ├── while_has_sub_field.sublime-snippet ├── if_get_field_options.sublime-snippet ├── if_the_field_options.sublime-snippet ├── if_get_sub_field_options.sublime-snippet ├── if_the_sub_field_options.sublime-snippet ├── while_has_sub_field_options.sublime-snippet ├── date_field.sublime-snippet ├── date_sub_field.sublime-snippet ├── date_field_options.sublime-snippet ├── flexible_field_part.sublime-snippet ├── image_id_get_field.sublime-snippet ├── image_object.sublime-snippet ├── image_object_subfield.sublime-snippet ├── image_id_get_field_options.sublime-snippet ├── image_object_options.sublime-snippet ├── repeater_field.sublime-snippet ├── google_map.sublime-snippet ├── repeater_field_options.sublime-snippet ├── google_map_sub_field.sublime-snippet ├── google_map_options.sublime-snippet ├── _util_create_options.sublime-snippet ├── _util_first_repeater_row.sublime-snippet ├── flexible_field_all.sublime-snippet ├── gallery_field_all.sublime-snippet ├── gallery_sub_field_all.sublime-snippet ├── gallery_field_options_all.sublime-snippet ├── relationship_field.sublime-snippet ├── relationship_sub_field.sublime-snippet └── relationship_field_options.sublime-snippet ├── messages ├── install.txt ├── 1.3.0.txt └── 1.2.0.txt ├── LICENSE └── README.md /messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "install": "messages/install.txt", 3 | "1.2.0": "messages/1.2.0.txt", 4 | "1.3.0": "messages/1.3.0.txt" 5 | } -------------------------------------------------------------------------------- /acf_snippets/get_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | gf 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/the_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tf 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/get_sub_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | gsf 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/the_sub_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tsf 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/if_get_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ifgf 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/if_the_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | iftf 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/get_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | gfo 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/the_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tfo 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/if_get_sub_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ifgsf 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/if_the_sub_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | iftsf 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/get_sub_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | gsfo 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/the_sub_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tsfo 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/while_has_sub_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | whsf 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/if_get_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ifgfo 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/if_the_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | iftfo 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/if_get_sub_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | ifgsfo 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/if_the_sub_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | iftsfo 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/while_has_sub_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | whsfo 7 | 8 | source.php 9 | 10 | -------------------------------------------------------------------------------- /acf_snippets/date_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | format('d-m-Y'); 5 | ]]> 6 | 7 | df 8 | 9 | source.php 10 | 11 | -------------------------------------------------------------------------------- /acf_snippets/date_sub_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | format('d-m-Y'); 5 | ]]> 6 | 7 | dsf 8 | 9 | source.php 10 | 11 | -------------------------------------------------------------------------------- /acf_snippets/date_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | format('d-m-Y'); 5 | ]]> 6 | 7 | dfo 8 | 9 | source.php 10 | 11 | -------------------------------------------------------------------------------- /messages/install.txt: -------------------------------------------------------------------------------- 1 | 2 | ==---------------> ACF SNIPPETS <--------------== 3 | 4 | Thanks for installing ACF Snippets! 5 | 6 | Please view the README.md file for a list of 7 | available snippets. 8 | 9 | ==---------------------------------------------== 10 | 11 | Feel free to Fork the snippet repo and submit a 12 | pull request: 13 | 14 | https://github.com/iamhexcoder/acf_snippets 15 | 16 | ==---------------------------------------------== 17 | 18 | Cheers! 19 | @baerkins 20 | -------------------------------------------------------------------------------- /acf_snippets/flexible_field_part.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | <${3:div}> 7 | 8 | 9 | 10 | ]]> 11 | 12 | ffpart 13 | 14 | source.php 15 | -------------------------------------------------------------------------------- /acf_snippets/image_id_get_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | '; 8 | 9 | ]]> 10 | 11 | imgf 12 | 13 | source.php 14 | 15 | -------------------------------------------------------------------------------- /acf_snippets/image_object.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | '; 9 | 10 | ]]> 11 | 12 | imgobj 13 | 14 | source.php 15 | 16 | -------------------------------------------------------------------------------- /acf_snippets/image_object_subfield.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | '; 9 | 10 | ]]> 11 | 12 | imgobjsf 13 | 14 | source.php 15 | 16 | -------------------------------------------------------------------------------- /acf_snippets/image_id_get_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | '; 8 | 9 | ]]> 10 | 11 | imgfo 12 | 13 | source.php 14 | 15 | -------------------------------------------------------------------------------- /acf_snippets/image_object_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | '; 9 | 10 | ]]> 11 | 12 | imgobjo 13 | 14 | source.php 15 | 16 | -------------------------------------------------------------------------------- /acf_snippets/repeater_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | <${2:ul}> 5 | 6 | <${3:li}> 7 | 8 | 9 | 11 | 12 | rf 13 | 14 | source.php 15 | 16 | -------------------------------------------------------------------------------- /acf_snippets/google_map.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |
8 |
9 |
10 | 11 |
13 | 14 | gmf 15 | 16 | source.php 17 |
18 | -------------------------------------------------------------------------------- /acf_snippets/repeater_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 4 | <${2:ul}> 5 | 6 | <${3:li}> 7 | 8 | 9 | 11 | 12 | rfo 13 | 14 | source.php 15 | 16 | -------------------------------------------------------------------------------- /acf_snippets/google_map_sub_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |
8 |
9 |
10 | 11 |
13 | 14 | gmsf 15 | 16 | source.php 17 |
18 | -------------------------------------------------------------------------------- /acf_snippets/google_map_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |
8 |
9 |
10 | 11 |
13 | 14 | gmfo 15 | 16 | source.php 17 |
18 | -------------------------------------------------------------------------------- /acf_snippets/_util_create_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | acfcreateoptions 16 | 17 | source.php 18 | 19 | -------------------------------------------------------------------------------- /acf_snippets/_util_first_repeater_row.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | <${2:div}> 8 | 10 | 12 | 13 | acffirstrepeater 14 | 15 | source.php 16 | 17 | -------------------------------------------------------------------------------- /acf_snippets/flexible_field_all.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | <${4:div}> 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | ffall 19 | 20 | source.php 21 | -------------------------------------------------------------------------------- /messages/1.3.0.txt: -------------------------------------------------------------------------------- 1 | ==---------------> ACF SNIPPETS <--------------== 2 | 3 | ================================================= 4 | Updates in 1.2.0 5 | ================================================= 6 | 7 | # WordPress Coding Standards 8 | Snippets now meet (WordPress space standards)[https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#space-usage]. 9 | 10 | Thanks to @davemac for the suggestion and prompting 11 | me to get proper. 12 | 13 | ================================================= 14 | 15 | Feel free to contribute to this repo: 16 | https://github.com/iamhexcoder/acf_snippets 17 | 18 | ================================================= 19 | 20 | Cheers, 21 | @baerkins -------------------------------------------------------------------------------- /messages/1.2.0.txt: -------------------------------------------------------------------------------- 1 | 2 | ==---------------> ACF SNIPPETS <--------------== 3 | 4 | ================================================= 5 | Updates in 1.2.0 6 | ================================================= 7 | 8 | # New Fields Added! 9 | - Relationship, Date, and Gallery fields added 10 | - Two utility snippets were added: 11 | `acfcreateoptions` 12 | `acffirstrepeater` 13 | - The Readme.md file has been updated to document 14 | these new fields. 15 | 16 | # Closing PHP tags were removed from a majority 17 | of the snippets 18 | 19 | ================================================= 20 | 21 | Feel free to contribute to this repo: 22 | https://github.com/iamhexcoder/acf_snippets 23 | 24 | ================================================= 25 | 26 | Cheers, 27 | @baerkins -------------------------------------------------------------------------------- /acf_snippets/gallery_field_all.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | <${2:ul}> 7 | 8 | <${3:li}> 9 | 10 | <?php echo \$image['alt']; ?> 11 | 12 |

13 | 14 | 15 | 16 |
18 | 19 | gallf 20 | 21 | source.php 22 |
23 | -------------------------------------------------------------------------------- /acf_snippets/gallery_sub_field_all.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | <${2:ul}> 7 | 8 | <${3:li}> 9 | 10 | <?php echo \$image['alt']; ?> 11 | 12 |

13 | 14 | 15 | 16 |
18 | 19 | gallsf 20 | 21 | source.php 22 |
23 | -------------------------------------------------------------------------------- /acf_snippets/gallery_field_options_all.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | <${2:ul}> 7 | 8 | <${3:li}> 9 | 10 | <?php echo \$image['alt']; ?> 11 | 12 |

13 | 14 | 15 | 16 |
18 | 19 | gallof 20 | 21 | source.php 22 |
23 | -------------------------------------------------------------------------------- /acf_snippets/relationship_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | <${2:ul}> 7 | 8 | 9 | <${3:li}> 10 | 11 |

12 | 13 | 14 | 15 | 16 |
18 | 19 | relf 20 | 21 | source.php 22 |
23 | -------------------------------------------------------------------------------- /acf_snippets/relationship_sub_field.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | <${2:ul}> 7 | 8 | 9 | <${3:li}> 10 | 11 |

12 | 13 | 14 | 15 | 16 |
18 | 19 | relsf 20 | 21 | source.php 22 |
23 | -------------------------------------------------------------------------------- /acf_snippets/relationship_field_options.sublime-snippet: -------------------------------------------------------------------------------- 1 | 2 | 6 | <${2:ul}> 7 | 8 | 9 | <${3:li}> 10 | 11 |

12 | 13 | 14 | 15 | 16 |
18 | 19 | relfo 20 | 21 | source.php 22 |
23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 iamhexcoder 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Advanced Custom Fields Snippets for Sublime Text 2 | ================================================ 3 | 4 | This is a collection of Sublime Text snippets for the [Advanced Custom Fields](http://www.advancedcustomfields.com/) Wordpress plugin. 5 | 6 | ## Installation 7 | 8 | ### Recommended 9 | 10 | Install this package with [Package Control](https://sublime.wbond.net/): 11 | 1. Install Package Control in Sublime. 12 | 2. Press `Cmd` + `Shift` + `P` (OSX) or `Ctrl` + `Shift` + `P` (Windows/Linux) 13 | 3. Select Install Package 14 | 4. Search 'ACF Snippets' 15 | 16 | ### Manual 17 | 18 | Copy this folder to the `Packages` folder of your Sublime Text installation. 19 | 20 | Mac users: Library/Application Support/Sublime Text/Packages 21 | 22 | ## Snippets 23 | 24 | Snippets are described by `tabTrigger` - `codeOutput`. 25 | 26 | To make things the easiest to remember, snippet triggers are typically named as abbreviations for their output. For example, `tf` outputs (T)he (F)ield. 27 | 28 | Field names and variable outputs that are auto-highlighted for replacement by Sublime Text are shown in the code wrapped in asterisks. 29 | 30 | *Note: All snippets need to be triggered within an open* ``. 31 | 32 | ### Standard Field Snippets 33 | |Snippet|Output| 34 | |-------|------| 35 | | `tf` | `the_field('*field_name*'); ?>` | 36 | | `iftf` | `if_the_field('*field_name*'); ?>` | 37 | | `gf` | `get_field('*field_name*'); ?>` | 38 | | `ifgf` | `if_get_field('*field_name*'); ?>` | 39 | | `df` | Outputs a block of code for a date field | 40 | | `imgf` | Outputs a block of code for an Image ID field | 41 | | `imgobj` | Outputs a block of code for an Image Object field | 42 | | `relf` | Outputs a basic loop for a Relationship field | 43 | 44 | 45 | ### Sub Field Snippets 46 | |Snippet|Output| 47 | |-------|------| 48 | | `tsf` | `the_sub_field('*field_name*'); ?>` | 49 | | `gsf` | `get_sub_field('*field_name*'); ?>` | 50 | | `whsf` | `while(has_sub_field('*field_name*')) : ?>` | 51 | | `ifgsf` | `if(get_sub_field('*field_name*')) : ?>` | 52 | | `dsf` | Outputs a block of code for a date field | 53 | | `relsf` | Outputs a basic loop for a Relationship field | 54 | 55 | 56 | ### Options Page Field Snippets 57 | *These snippets are the same as the standard and repeater snippets, but with an 'o' appended to the end.* 58 | 59 | |Snippet|Output| 60 | |-------|------| 61 | | `tfo` | `the_field('*field_name*', 'options'); ?>` | 62 | | `iftfo` | `if_the_field('*field_name*', 'options'); ?>` | 63 | | `gfo` | `get_field('*field_name*', 'options'); ?>` | 64 | | `ifgfo` | `if_get_field('*field_name*'); ?>` | 65 | | `tsfo` | `the_sub_field('*field_name*', 'options'); ?>` | 66 | | `whsfo` | `while(has_sub_field('*field_name*', 'options')) : ?>` | 67 | | `ifgsfo` | `if(get_sub_field('*field_name*', 'options')) : ?>` | 68 | | `imgfo` | Outputs a block of code for an Image ID field from the options page | 69 | | `imgobjo` | Outputs a block of code for an Image Object field from the options page | 70 | | `gmfo` | Outputs Google Map Field code for a single location from the options page | 71 | | `relfo` | Outputs a basic loop for a Relationship field from the options page | 72 | 73 | ### Repeater Field Snippets 74 | |Snippet|Output| 75 | |-------|------| 76 | | `rf` | Outputs a block of code that opens and closes a repeater field loop | 77 | | `rfo` | Outputs a block of code that opens and closes a repeater field loop from the options page. | 78 | 79 | ### Flexible Field Snippets 80 | |Snippet|Output| 81 | |-------|------| 82 | | `ffall` | Outputs a complete block (think _all_ of the code) of a flexible field statement with a single flex field row element | 83 | | `ffpart` | Outputs only a single flex field row element (think _part_ of the code) | 84 | 85 | ### Gallery Field Snippets 86 | | `gallf` | Outputs a block of code for an Image Gallery field | 87 | | `gallsf` | Outputs a block of code for an Image Gallery sub-field | 88 | | `gallo` | Outputs a block of code for an Image Gallery Field on an Options Page | 89 | 90 | ### Google Map Field Snippets 91 | |Snippet|Output| 92 | |-------|------| 93 | | `gmf` | Outputs Google Map Field code for a single location | 94 | | `gmsf` | Outputs Google Map Sub Field code for a single location | 95 | 96 | ## Utility Snippets 97 | These snippets serve specific purposes, but are a few bits of code that I have found useful, so maybe you will too! 98 | 99 | `acfcreateoptions` 100 | Used in functions.php, this snippet will output code that will create an mulitple options page in ACF 5. Code should be editted to reflect Option page names. 101 | 102 | `acffirstrepeater` 103 | This will output a repeater snippet that will retrieve only the first row of a repeater field. 104 | 105 | --------------------------------------------------------------------------------