ACF Snippets
Snippets for Advanced Custom Fields
Details
Installs
- Total 11K
- Win 6K
- Mac 3K
- Linux 784
Jul 27 | Jul 26 | Jul 25 | Jul 24 | Jul 23 | Jul 22 | Jul 21 | Jul 20 | Jul 19 | Jul 18 | Jul 17 | Jul 16 | Jul 15 | Jul 14 | Jul 13 | Jul 12 | Jul 11 | Jul 10 | Jul 9 | Jul 8 | Jul 7 | Jul 6 | Jul 5 | Jul 4 | Jul 3 | Jul 2 | Jul 1 | Jun 30 | Jun 29 | Jun 28 | Jun 27 | Jun 26 | Jun 25 | Jun 24 | Jun 23 | Jun 22 | Jun 21 | Jun 20 | Jun 19 | Jun 18 | Jun 17 | Jun 16 | Jun 15 | Jun 14 | Jun 13 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 3 | 0 | 0 | 0 | 0 | 1 | 0 |
Mac | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Advanced Custom Fields Snippets for Sublime Text
This is a collection of Sublime Text snippets for the Advanced Custom Fields Wordpress plugin.
Installation
Recommended
Install this package with Package Control:
1. Install Package Control in Sublime.
2. Press Cmd
+ Shift
+ P
(OSX) or Ctrl
+ Shift
+ P
(Windows/Linux)
3. Select Install Package
4. Search 'ACF Snippets'
Manual
Copy this folder to the Packages
folder of your Sublime Text installation.
Mac users: Library/Application Support/Sublime Text/Packages
Snippets
Snippets are described by tabTrigger
- codeOutput
.
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.
Field names and variable outputs that are auto-highlighted for replacement by Sublime Text are shown in the code wrapped in asterisks.
Note: All snippets need to be triggered within an open <?php
tag. Once triggered, the snippet will close out the tag with ?>
.
Standard Field Snippets
Snippet | Output |
---|---|
tf |
the_field('*field_name*'); ?> |
iftf |
if_the_field('*field_name*'); ?> |
gf |
get_field('*field_name*'); ?> |
ifgf |
if_get_field('*field_name*'); ?> |
df |
Outputs a block of code for a date field |
imgf |
Outputs a block of code for an Image ID field |
imgobj |
Outputs a block of code for an Image Object field |
relf |
Outputs a basic loop for a Relationship field |
Sub Field Snippets
Snippet | Output |
---|---|
tsf |
the_sub_field('*field_name*'); ?> |
gsf |
get_sub_field('*field_name*'); ?> |
whsf |
while(has_sub_field('*field_name*')) : ?> |
ifgsf |
if(get_sub_field('*field_name*')) : ?> |
dsf |
Outputs a block of code for a date field |
relsf |
Outputs a basic loop for a Relationship field |
Options Page Field Snippets
These snippets are the same as the standard and repeater snippets, but with an 'o' appended to the end.
Snippet | Output |
---|---|
tfo |
the_field('*field_name*', 'options'); ?> |
iftfo |
if_the_field('*field_name*', 'options'); ?> |
gfo |
get_field('*field_name*', 'options'); ?> |
ifgfo |
if_get_field('*field_name*'); ?> |
tsfo |
the_sub_field('*field_name*', 'options'); ?> |
whsfo |
while(has_sub_field('*field_name*', 'options')) : ?> |
ifgsfo |
if(get_sub_field('*field_name*', 'options')) : ?> |
imgfo |
Outputs a block of code for an Image ID field from the options page |
imgobjo |
Outputs a block of code for an Image Object field from the options page |
gmfo |
Outputs Google Map Field code for a single location from the options page |
relfo |
Outputs a basic loop for a Relationship field from the options page |
Repeater Field Snippets
Snippet | Output |
---|---|
rf |
Outputs a block of code that opens and closes a repeater field loop |
rfo |
Outputs a block of code that opens and closes a repeater field loop from the options page. |
Flexible Field Snippets
Snippet | Output |
---|---|
ffall |
Outputs a complete block (think all of the code) of a flexible field statement with a single flex field row element |
ffpart |
Outputs only a single flex field row element (think part of the code) |
Gallery Field Snippets
| gallf
| Outputs a block of code for an Image Gallery field |
| gallsf
| Outputs a block of code for an Image Gallery sub-field |
| gallo
| Outputs a block of code for an Image Gallery Field on an Options Page |
Google Map Field Snippets
Snippet | Output |
---|---|
gmf |
Outputs Google Map Field code for a single location |
gmsf |
Outputs Google Map Sub Field code for a single location |
Utility Snippets
These snippets serve specific purposes, but are a few bits of code that I have found useful, so maybe you will too!
acfcreateoptions
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.
acffirstrepeater
This will output a repeater snippet that will retrieve only the first row of a repeater field.