diff --git a/README.md b/README.md
index 2988fea..998f6fc 100644
--- a/README.md
+++ b/README.md
@@ -43,3 +43,21 @@ function my_input_counter_filter($ids=array()) {
return $ids;
}
```
+
+### Filter the Display
+To filter the display add a filter wherever you would add a filter
+```
+add_filter('acf-input-counter/display', 'my_acf_counter_filter');
+function my_acf_counter_filter($display) {
+ $display = 'Characters = %%len%% of %%max%%';
+ return $display;
+}
+```
+In the example string above `%%len%%` represents where you want the current character count shown and `%%max%%`
+represents where you want the fields maximum length displayed. You can generate this string any way you want.
+For example, you can translate it or use `sprintf()`, as long as it contains the two markers where the values
+should be shown. If you do not include these markers then they simply will not be shown. It's up to you to
+make sure they are present.
+
+I've puzzled with how to allow this to be altered and this is the best I've been able to come up with.
+If you have a better idea, let me know in the issues.
diff --git a/acf-input-counter.php b/acf-input-counter.php
index bc523cc..be585f1 100644
--- a/acf-input-counter.php
+++ b/acf-input-counter.php
@@ -4,7 +4,7 @@
Plugin Name: ACF Input Counter
Plugin URI: https://github.com/Hube2/acf-input-counter/
Description: Show character count for limited text and textarea fields
- Version: 1.1.1
+ Version: 1.2.0
Author: John A. Huebner II
Author URI: https://github.com/Hube2/
GitHub Plugin URI: https://github.com/Hube2/acf-input-counter/
@@ -18,7 +18,7 @@
class acf_input_counter {
- private $version = '1.1.1';
+ private $version = '1.2.0';
public function __construct() {
add_action('acf/render_field/type=text', array($this, 'render_field'), 20, 1);
@@ -99,10 +99,14 @@ public function render_field($field) {
if (!$insert) {
return;
}
+ $display = 'chars: %%len%% of %%max%%';
+ $display = apply_filters('acf-input-counter/display', $display);
+ $display = str_replace('%%len%%', ''.$len.'', $display);
+ $display = str_replace('%%max%%', $max, $display);
?>
',$len,' of ',$max;
+ echo $display;
?>