Skip to content

Commit

Permalink
added documentation for class and ID filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Hube2 committed Sep 27, 2016
1 parent 0f93ba0 commit 3f738f1
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,30 @@ This plugin will not work in ACF 4 for 2 reasons:
* The JavaScript used in this plugin is specific to ACF 5

This plugin also serves as a simple example of how to extend the functionality of fields in ACF 5.

### Add Counter Filter
By defaults, the counter is added to all text and textarea fields that have a max length. If you would like
to only add the counter on specific fields you can filter them by either the ACF Wrapper Class or the ACF
Wrapper ID of the field. You can allow multiple classes or ids. If classes or ID values are present then only
fields that have one of the classes or ids will include a counter.

**Filter by Class**
```
add_filter('acf-input-counter/classes', 'my_input_counter_filter');
function my_input_counter_filter($classes=array()) {
// add 1 or more classes to the array
$classes[] = 'this-is-a-class';
return $classes;
}
```
fields that have one of the classes or ids will include a counter.

**Filter by ID**
```
add_filter('acf-input-counter/ids', 'my_input_counter_filter');
function my_input_counter_filter($ids=array()) {
// add 1 or more classes to the array
$ids[] = 'this-is-an-ID';
return $ids;
}
```

0 comments on commit 3f738f1

Please sign in to comment.