diff --git a/acf-limiter.php b/acf-limiter.php old mode 100755 new mode 100644 index 79d0945..18a6962 --- a/acf-limiter.php +++ b/acf-limiter.php @@ -1,30 +1,98 @@ settings = array( + 'version' => '1.3.0', + 'url' => plugin_dir_url(__FILE__), + 'path' => plugin_dir_path(__FILE__) + ); + + + // include field + add_action('acf/include_field_types', array($this, 'include_field')); // v5 + add_action('acf/register_fields', array($this, 'include_field')); // v4 + } + + + /** + * include_field + * + * This function will include the field type class + * + * @type function + * @date 17/02/2016 + * @since 1.0.0 + * + * @param $version (int) major ACF version. Defaults to false + * @return void + */ + + public function include_field($version = false) + { + + // support empty $version + if (!$version) { + $version = 4; + } + + + // load acf-limiter-field + load_plugin_textdomain('acf-limiter-field', false, plugin_basename(dirname(__FILE__)) . '/lang'); + + + // include + include_once('fields/class-atomic-smash-acf-field-limiter-v' . $version . '.php'); + } } -add_action('acf/register_fields', 'register_fields_limiter'); + +// initialize +new atomic_smash_acf_plugin_limiter(); + + +// class_exists check +endif; diff --git a/css/jquery-ui-progressbar.min.css b/assets/css/jquery-ui-progressbar.min.css similarity index 100% rename from css/jquery-ui-progressbar.min.css rename to assets/css/jquery-ui-progressbar.min.css diff --git a/assets/css/limiter.css b/assets/css/limiter.css new file mode 100755 index 0000000..86d5053 --- /dev/null +++ b/assets/css/limiter.css @@ -0,0 +1,10 @@ +.counterWrapper { + height: 0px; + top: -23px; + position: relative; + left: 8px; + color: #333; + margin-bottom: 10px; + font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, + monospace; +} diff --git a/assets/js/limiter.js b/assets/js/limiter.js new file mode 100755 index 0000000..dacb062 --- /dev/null +++ b/assets/js/limiter.js @@ -0,0 +1,93 @@ +(function ($) { + function characterLimit(currentField) { + progressBar = $(currentField).next(".progressBar"); + + chars = $(currentField)[0].value.length; + + limit = $(currentField).data("characterlimit"); + + if (chars > limit) { + currentField.value = currentField.value.substr(0, limit); + chars = limit; + } + + charactersRemaining = limit - chars; + + $(currentField) + .next() + .next(".counterWrapper") + .children(".limiterCount") + .html(chars); + + percentage = Math.floor((chars / limit) * 100); + + $(progressBar).progressbar({ + value: percentage, + }); + } + + function initialize_field($el) { + //$el.doStuff(); + + //Setup progress bars of all limiter fields + + $($el) + .find(".limiterField") + .each(function () { + characterLimit(this); + }); + + //Run characterLimit() when the field is being used + $($el) + .find(".limiterField") + .on("keyup focus", function () { + characterLimit(this); + }); + } + + if (typeof acf.add_action !== "undefined") { + /** + * ready append (ACF5) + * + * These are 2 events which are fired during the page load + * ready = on page load similar to $(document).ready() + * append = on new DOM elements appended via repeater field + * + * @type event + * @date 20/07/13 + * + * @param $el (jQuery selection) the jQuery element which contains the ACF fields + * @return n/a + */ + + acf.add_action("ready append", function ($el) { + // search $el for fields of type 'limiter' + acf.get_fields({ type: "limiter" }, $el).each(function () { + initialize_field($(this)); + }); + }); + } else { + /** + * acf/setup_fields (ACF4) + * + * This event is triggered when ACF adds any new elements to the DOM. + * + * @type function + * @since 1.0.0 + * @date 01/01/12 + * + * @param event e: an event object. This can be ignored + * @param Element postbox: An element which contains the new HTML + * + * @return n/a + */ + + $(document).on("acf/setup_fields", function (e, postbox) { + $(postbox) + .find('.field[data-field_type="limiter"]') + .each(function () { + initialize_field($(this)); + }); + }); + } +})(jQuery); diff --git a/css/limiter.css b/css/limiter.css deleted file mode 100755 index 972aa74..0000000 --- a/css/limiter.css +++ /dev/null @@ -1,8 +0,0 @@ -.counterWrapper{ - height: 0px; - top: -23px; - position: relative; - left: 8px; - color: #ccc; - margin-bottom: 10px; -} diff --git a/fields/class-atomic-smash-acf-field-limiter-v4.php b/fields/class-atomic-smash-acf-field-limiter-v4.php new file mode 100644 index 0000000..8d369db --- /dev/null +++ b/fields/class-atomic-smash-acf-field-limiter-v4.php @@ -0,0 +1,195 @@ +name = 'limiter'; + $this->label = __('Limiter'); + $this->category = __("Basic", 'acf-limiter-field'); // Basic, Content, Choice, etc + $this->defaults = array( + // add default here to merge into your field. + // This makes life easy when creating the field options as you don't need to use any if( isset('') ) logic. eg: + //'preview_size' => 'thumbnail' + ); + + + // do not delete! + parent::__construct(); + + + // settings + $this->settings = $settings; + } + + + /** + * create_options() + * + * Create extra options for your field. This is rendered when editing a field. + * The value of $field['name'] can be used (like below) to save extra data to the $field + * + * @type action + * @since 3.6 + * @date 23/01/13 + * + * @param $field - an array holding all the field's data + */ + + public function create_options($field) + { + // defaults? + /* + $field = array_merge($this->defaults, $field); + */ + + $field['character_number'] = isset($field['character_number']) ? $field['character_number'] : ''; ?> + + + + + + 'text', + 'name' => 'fields['.$field['name'].'][character_number]', + 'value' => $field['character_number'] + )); ?> + + + + + + + + 'radio', + 'name' => 'fields['.$field['name'].'][displayCount]', + 'value' => $field['displayCount'], + 'layout' => 'vertical', + 'choices' => array( + 1 => __("Yes", 'acf'), + 0 => __("No", 'acf') + ) + )); ?> + + + + + + ', '', $field['value']); + echo ''; + + echo('
'); + + if (isset($field['displayCount'])) { + if ($field['displayCount'] == 1) { + echo('
/ '.$field['character_number'].'
'); + }; + } + } + + + /* + * input_admin_enqueue_scripts() + * + * This action is called in the admin_enqueue_scripts action on the edit screen where your field is created. + * Use this action to add CSS + JavaScript to assist your create_field() action. + * + * $info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts + * @type action + * @since 3.6 + * @date 23/01/13 + */ + + public function input_admin_enqueue_scripts() + { + + // vars + $url = $this->settings['url']; + $version = $this->settings['version']; + + + // register & include JS + wp_register_script('acf-limiter-field', "{$url}assets/js/limiter.js", array('acf-input', 'jquery-ui-progressbar'), $version); + wp_enqueue_script('acf-limiter-field'); + wp_enqueue_script('jquery-ui-progressbar'); + + + // register & include CSS + wp_register_style('acf-limiter-field', "{$url}assets/css/limiter.css", array('acf-input', 'jquery-ui-progressbar'), $version); + wp_enqueue_style('acf-limiter-field'); + + wp_register_style('jquery-ui-progressbar', "{$url}assets/css/jquery-ui-progressbar.min.css", array(), $version); + wp_enqueue_style('jquery-ui-progressbar'); + } +} + + +// initialize +new atomic_smash_acf_field_limiter($this->settings); + + +// class_exists check +endif; + +?> \ No newline at end of file diff --git a/fields/class-atomic-smash-acf-field-limiter-v5.php b/fields/class-atomic-smash-acf-field-limiter-v5.php new file mode 100644 index 0000000..2c080d2 --- /dev/null +++ b/fields/class-atomic-smash-acf-field-limiter-v5.php @@ -0,0 +1,309 @@ +name = 'limiter'; + + + /** + * label (string) Multiple words, can include spaces, visible when selecting a field type + */ + + $this->label = __('Limiter', 'acf-limiter-field'); + + + /** + * category (string) basic | content | choice | relational | jquery | layout | CUSTOM GROUP NAME + */ + + $this->category = 'basic'; + + + /** + * defaults (array) Array of default settings which are merged into the field object. These are used later in settings + */ + + $this->defaults = array( + 'default_value' => '', + 'new_lines' => '', + 'character_number' => 150, + 'display_characters' => 1, + 'rows' => '', + 'placeholder' => '', + ); + + + /** + * l10n (array) Array of strings that are used in JavaScript. This allows JS strings to be translated in PHP and loaded via: + * var message = acf._e('limiter', 'error'); + */ + + $this->l10n = array( + 'error' => __('Error! Please enter a higher value', 'acf-limiter-field'), + ); + + + /** + * settings (array) Store plugin settings (url, path, version) as a reference for later use with assets + */ + + $this->settings = $settings; + + + // do not delete! + parent::__construct(); + } + + + /** + * render_field_settings() + * + * Create extra settings for your field. These are visible when editing a field + * + * @type action + * @since 3.6 + * @date 23/01/13 + * + * @param $field (array) the $field being edited + * @return n/a + */ + + public function render_field_settings($field) + { + + + // default_value + acf_render_field_setting($field, array( + 'label' => __('Default Value', 'acf'), + 'instructions' => __('Appears when creating a new post', 'acf'), + 'type' => 'textarea', + 'name' => 'default_value', + 'rows' => 4 + )); + + + // placeholder + acf_render_field_setting($field, array( + 'label' => __('Placeholder Text', 'acf'), + 'instructions' => __('Appears within the input', 'acf'), + 'type' => 'text', + 'name' => 'placeholder', + )); + + acf_render_field_setting($field, array( + 'label' => __('Character Limit', 'acf'), + 'instructions' => __('How many characters would you like to limit', 'acf-limiter'), + 'type' => 'number', + 'name' => 'character_number', + 'append' => __('characters', 'acf-limiter-field') + )); + + acf_render_field_setting($field, array( + 'label' => __('Display character limit', 'acf-limiter'), + 'instructions' => __('Show the number of characters left over the top of the progress bar.', 'acf-limiter'), + 'type' => 'radio', + 'name' => 'display_characters', + 'choices' => array( + 1 => __("No", 'acf'), + 0 => __("Yes", 'acf'), + ), + 'layout' => 'horizontal' + )); + + // rows + acf_render_field_setting($field, array( + 'label' => __('Rows', 'acf'), + 'instructions' => __('Sets the textarea height', 'acf'), + 'type' => 'number', + 'name' => 'rows', + 'placeholder' => 4, + 'append' => __('textlines', 'acf-limiter-field') + )); + + // formatting + acf_render_field_setting($field, array( + 'label' => __('New Lines', 'acf'), + 'instructions' => __('Controls how new lines are rendered', 'acf'), + 'type' => 'select', + 'name' => 'new_lines', + 'choices' => array( + 'wpautop' => __("Automatically add paragraphs", 'acf'), + 'br' => __("Automatically add <br>", 'acf'), + '' => __("No Formatting", 'acf') + ) + )); + } + + + + /** + * render_field() + * + * Create the HTML interface for your field + * + * @param $field (array) the $field being rendered + * + * @type action + * @since 3.6 + * @date 23/01/13 + * + * @param $field (array) the $field being edited + * @return n/a + */ + + public function render_field($field) + { + + + // Set row default + if (empty($field['rows'])) { + $field['rows'] = 4; + } + + // Set character limit + if (empty($field['character_number']) || $field['character_number'] < 1) { + $character_number = 999999; + } else { + $character_number = $field['character_number']; + } + + // Template?> + + +
+ + + +
+ / +
+ + settings['url']; + $version = $this->settings['version']; + + + // register & include JS + wp_register_script('acf-limiter-field', "{$url}assets/js/limiter.js", array('acf-input', 'jquery-ui-progressbar'), $version); + wp_enqueue_script('acf-limiter-field'); + wp_enqueue_script('jquery-ui-progressbar'); + + + // register & include CSS + wp_register_style('acf-limiter-field', "{$url}assets/css/limiter.css", array('acf-input', 'jquery-ui-progressbar'), $version); + wp_enqueue_style('acf-limiter-field'); + + wp_register_style('jquery-ui-progressbar', "{$url}assets/css/jquery-ui-progressbar.min.css", array(), $version); + wp_enqueue_style('jquery-ui-progressbar'); + } + + + /** + * format_value() + * + * This filter is applied to the $value after it is loaded from the db and before it is returned to the template + * + * @type filter + * @since 3.6 + * @date 23/01/13 + * + * @param $value (mixed) the value which was loaded from the database + * @param $post_id (mixed) the $post_id from which the value was loaded + * @param $field (array) the field array holding all the field options + * + * @return $value (mixed) the modified value + */ + + public function format_value($value, $post_id, $field) + { + + // bail early if no value or not for template + if (empty($value) || !is_string($value)) { + return $value; + } + + // new lines + if ($field['new_lines'] == 'wpautop') { + return wpautop($value); + } + + if ($field['new_lines'] == 'br') { + return nl2br($value); + } + + // return + return $value; + } +} + + +// initialize +new atomic_smash_acf_field_limiter($this->settings); + + +// class_exists check +endif; + +?> \ No newline at end of file diff --git a/js/limiter.js b/js/limiter.js deleted file mode 100755 index 9e7abfb..0000000 --- a/js/limiter.js +++ /dev/null @@ -1,109 +0,0 @@ -(function($) { - function characterLimit(currentField) { - - progressBar = $(currentField).next(".progressBar"); - - chars = $(currentField)[0].value.length; - - limit = $(currentField).data('characterlimit'); - - if (chars > limit) { - currentField.value = currentField.value.substr(0, limit); - chars = limit; - } - - charactersRemaining = limit - chars; - - $(currentField).next().next(".counterWrapper").children(".limiterCount").html(chars); - - percentage = Math.floor((chars / limit) * 100); - - - $(progressBar).progressbar({ - value: percentage - }); - - } - - - function initialize_field($el) { - - //$el.doStuff(); - - //Setup progress bars of all limiter fields - - $($el).find('.limiterField').each(function() { - characterLimit(this); - }); - - - //Run characterLimit() when the field is being used - $($el).find('.acf-field-limiter').on("keyup focus", '.limiterField', function() { - characterLimit(this); - }); - - - } - - - if (typeof acf.add_action !== 'undefined') { - - /* - * ready append (ACF5) - * - * These are 2 events which are fired during the page load - * ready = on page load similar to $(document).ready() - * append = on new DOM elements appended via repeater field - * - * @type event - * @date 20/07/13 - * - * @param $el (jQuery selection) the jQuery element which contains the ACF fields - * @return n/a - */ - - acf.add_action('ready append', function($el) { - - // search $el for fields of type 'limiter' - acf.get_fields({type: 'limiter'}, $el).each(function() { - - initialize_field($(this)); - - }); - - }); - - - } else { - - - /* - * acf/setup_fields (ACF4) - * - * This event is triggered when ACF adds any new elements to the DOM. - * - * @type function - * @since 1.0.0 - * @date 01/01/12 - * - * @param event e: an event object. This can be ignored - * @param Element postbox: An element which contains the new HTML - * - * @return n/a - */ - - $(document).on('acf/setup_fields', function(e, postbox) { - - $(postbox).find('.field[data-field_type="limiter"]').each(function() { - - initialize_field($(this)); - - }); - - }); - - - } - - -})(jQuery); diff --git a/js/wysiwyg_limiter.js b/js/wysiwyg_limiter.js deleted file mode 100755 index 02f52af..0000000 --- a/js/wysiwyg_limiter.js +++ /dev/null @@ -1,105 +0,0 @@ -var loadrepeater = function ( ed ) { - //console.log(ed.startContent); - - if(ed.editorId != "content"){ - - - ed.editorDomLocation = "#wp-"+ed.editorId+"-wrap"; - ed.characterLimit = jQuery(ed.editorDomLocation).next(".progressBar").data('characterlimit'); - - if(ed.characterLimit != ""){ - cnt_cur = ed.startContent.replace(/<\/?[^>]+(>|$)/g,"").replace(/ /gi,""); - - //alert(jQuery(ed.editorDomLocation).next(".progressBar").data('characterlimit')); - - percentage = Math.floor((cnt_cur.length / ed.characterLimit)*100); - //alert(percentage); - progressBar = jQuery(ed.editorDomLocation).next(".progressBar"); - - jQuery( progressBar ).progressbar({ - value: percentage - }); - - - jQuery(ed.editorDomLocation).next().next(".progressText").html( cnt_cur.length + " out of " + ed.characterLimit); - - } - - - } - -} - -var repeater = function ( e,ed ) { - if(ed.characterLimit != ""){ - - //console.log(e); - console.log(ed); - - var targetId = e.target.id; - var text = ''; - - switch ( targetId ) { - - case 'content': - text = jQuery('#content').val(); - break; - - case 'tinymce': - if ( tinymce.activeEditor ) - text = tinymce.activeEditor.getContent(); - break; - } - - - - //console.log(text.length); - - cnt_cur = text.replace(/<\/?[^>]+(>|$)/g,"").replace(/ /gi,""); - - //console.log(cnt_cur.length); - //alert(targetId); - if(ed.editorId != "content"){ - - if(e.type == 'keydown'){ - //} - //alert(browserIsIE); - - //alert(text); - if(cnt_cur.length <= ed.characterLimit){ - ed.TESTval = text; - } - }else{ - - if(text != ed.TESTval){ - if(cnt_cur.length > ed.characterLimit){ - var bookmark = ed.selection.getBookmark(2, true); - ed.setContent(ed.TESTval); - ed.selection.moveToBookmark(bookmark); - - - - } - } - } - } - - - - percentage = Math.floor((cnt_cur.length / ed.characterLimit)*100); - //alert(percentage); - progressBar = jQuery(ed.editorDomLocation).next(".progressBar"); - - jQuery( progressBar ).progressbar({ - value: percentage - }); - - jQuery(ed.editorDomLocation).next().next(".progressText").html( cnt_cur.length + " out of " + ed.characterLimit); - - - - - - - } -} diff --git a/limiter-v3.php b/limiter-v3.php deleted file mode 100755 index f921ceb..0000000 --- a/limiter-v3.php +++ /dev/null @@ -1,384 +0,0 @@ -name = 'limiter'; - $this->title = __('Limiter'); - $this->defaults = array( - // add default here to merge into your field. - // This makes life easy when creating the field options as you don't need to use any if( isset('') ) logic. eg: - //'preview_size' => 'thumbnail' - ); - - - // settings - // settings - $this->settings = array( - 'path' => $this->helpers_get_path( __FILE__ ), - 'dir' => $this->helpers_get_dir( __FILE__ ), - 'version' => '1.0.0' - ); - - } - - - /* - * helpers_get_path - * - * @description: calculates the path (works for plugin / theme folders) - * @since: 3.6 - * @created: 30/01/13 - */ - - function helpers_get_path( $file ) - { - return trailingslashit(dirname($file)); - } - - - - /* - * helpers_get_dir - * - * @description: calculates the directory (works for plugin / theme folders) - * @since: 3.6 - * @created: 30/01/13 - */ - - function helpers_get_dir( $file ) - { - $dir = trailingslashit(dirname($file)); - $count = 0; - - - // sanitize for Win32 installs - $dir = str_replace('\\' ,'/', $dir); - - - // if file is in plugins folder - $wp_plugin_dir = str_replace('\\' ,'/', WP_PLUGIN_DIR); - $dir = str_replace($wp_plugin_dir, WP_PLUGIN_URL, $dir, $count); - - - if( $count < 1 ) - { - // if file is in wp-content folder - $wp_content_dir = str_replace('\\' ,'/', WP_CONTENT_DIR); - $dir = str_replace($wp_content_dir, WP_CONTENT_URL, $dir, $count); - } - - - if( $count < 1 ) - { - // if file is in ??? folder - $wp_dir = str_replace('\\' ,'/', ABSPATH); - $dir = str_replace($wp_dir, site_url('/'), $dir); - } - - - return $dir; - } - - - /*-------------------------------------------------------------------------------------- - * - * create_options - * - this function is called from core/field_meta_box.php to create extra options - * for your field - * - * @params - * - $key (int) - the $_POST obejct key required to save the options to the field - * - $field (array) - the field object - * - * @author Elliot Condon - * @since 2.2.0 - * - *-------------------------------------------------------------------------------------*/ - - function create_options($key, $field) - { - //$field['character_number'] = isset($field['character_number']) ? $field['character_number'] : ''; - - if($field['character_number'] == ""){ - - $field['character_number'] = 150; - - } - - - - ?> - - - - - - parent->create_field(array( - 'type' => 'text', - 'name' => 'fields['.$key.'][character_number]', - 'value' => $field['character_number'], - )); - ?> - - - - - - - - 'radio', - 'name' => 'fields['.$key.'][displayCount]', - 'value' => $field['displayCount'], - 'layout' => 'horizontal', - 'choices' => array('No','Yes') - )); - ?> - - - - ','',$field['value']); - echo ''; - - echo('
'); - - if(isset($field['displayCount'])){ - if($field['displayCount'] == 1){ - echo('
/ '.$field['character_number'].'
'); - } - } - - } - - - /*-------------------------------------------------------------------------------------- - * - * admin_head - * - this function is called in the admin_head of the edit screen where your field - * is created. Use this function to create css and javascript to assist your - * create_field() function. - * - * @author Elliot Condon - * @since 2.2.0 - * - *-------------------------------------------------------------------------------------*/ - - function admin_head() - { - // Note: This function can be removed if not used - } - - - /*-------------------------------------------------------------------------------------- - * - * admin_print_scripts / admin_print_styles - * - this function is called in the admin_print_scripts / admin_print_styles where - * your field is created. Use this function to register css and javascript to assist - * your create_field() function. - * - * @author Elliot Condon - * @since 3.0.0 - * - *-------------------------------------------------------------------------------------*/ - - function admin_print_scripts() - { - // Note: This function can be removed if not used - - - - wp_register_script( 'acf-limiter', $this->settings['dir'] . 'js/limiter.js', array('acf-input'), $this->settings['version'] ); - - - //jquery-ui-progressbar - wp_enqueue_script( 'jquery-ui-progressbar'); - - - // scripts - wp_enqueue_script(array( - 'acf-limiter', - )); - - // styles - - - - - - - - } - - function admin_print_styles() - { - // Note: This function can be removed if not used - - - - wp_register_style( 'jquery-ui-progressbar.min', $this->settings['dir'] . 'css/jquery-ui-progressbar.min.css', array('acf-input'), $this->settings['version'] ); - - wp_register_style( 'limiterCSS', $this->settings['dir'] . 'css/limiter.css', array('acf-input'), $this->settings['version'] ); - - //jquery-ui-progressbar - // styles - wp_enqueue_style(array( - 'jquery-ui-progressbar.min','limiterCSS' - )); - - - - - - } - - - /*-------------------------------------------------------------------------------------- - * - * update_value - * - this function is called when saving a post object that your field is assigned to. - * the function will pass through the 3 parameters for you to use. - * - * @params - * - $post_id (int) - usefull if you need to save extra data or manipulate the current - * post object - * - $field (array) - usefull if you need to manipulate the $value based on a field option - * - $value (mixed) - the new value of your field. - * - * @author Elliot Condon - * @since 2.2.0 - * - *-------------------------------------------------------------------------------------*/ - - function update_value($post_id, $field, $value) - { - // Note: This function can be removed if not used - - // do stuff with value - - // save value - parent::update_value($post_id, $field, $value); - } - - - - - - /*-------------------------------------------------------------------------------------- - * - * get_value - * - called from the edit page to get the value of your field. This function is useful - * if your field needs to collect extra data for your create_field() function. - * - * @params - * - $post_id (int) - the post ID which your value is attached to - * - $field (array) - the field object. - * - * @author Elliot Condon - * @since 2.2.0 - * - *-------------------------------------------------------------------------------------*/ - - function get_value($post_id, $field) - { - // Note: This function can be removed if not used - - // get value - $value = parent::get_value($post_id, $field); - - // format value - - // return value - return $value; - } - - - /*-------------------------------------------------------------------------------------- - * - * get_value_for_api - * - called from your template file when using the API functions (get_field, etc). - * This function is useful if your field needs to format the returned value - * - * @params - * - $post_id (int) - the post ID which your value is attached to - * - $field (array) - the field object. - * - * @author Elliot Condon - * @since 3.0.0 - * - *-------------------------------------------------------------------------------------*/ - - function get_value_for_api($post_id, $field) - { - // Note: This function can be removed if not used - - // get value - $value = $this->get_value($post_id, $field); - - // format value - - // return value - return $value; - - } - -} - -?> \ No newline at end of file diff --git a/limiter-v4.php b/limiter-v4.php deleted file mode 100755 index 71c7d0e..0000000 --- a/limiter-v4.php +++ /dev/null @@ -1,416 +0,0 @@ -name = 'limiter'; - $this->label = __('Limiter'); - $this->category = __("Basic",'acf'); // Basic, Content, Choice, etc - $this->defaults = array( - // add default here to merge into your field. - // This makes life easy when creating the field options as you don't need to use any if( isset('') ) logic. eg: - //'preview_size' => 'thumbnail' - ); - - - // do not delete! - parent::__construct(); - - - // settings - $this->settings = array( - 'path' => apply_filters('acf/helpers/get_path', __FILE__), - 'dir' => apply_filters('acf/helpers/get_dir', __FILE__), - 'version' => '1.0.0' - ); - - } - - - /* - * create_options() - * - * Create extra options for your field. This is rendered when editing a field. - * The value of $field['name'] can be used (like bellow) to save extra data to the $field - * - * @type action - * @since 3.6 - * @date 23/01/13 - * - * @param $field - an array holding all the field's data - */ - - function create_options( $field ) - { - // defaults? - /* - $field = array_merge($this->defaults, $field); - */ - - $field['character_number'] = isset($field['character_number']) ? $field['character_number'] : ''; - - ?> - - - - - - 'text', - 'name' => 'fields['.$field['name'].'][character_number]', - 'value' => $field['character_number'] - )); - - - - - ?> - - - - - - - - 'radio', - 'name' => 'fields['.$field['name'].'][displayCount]', - 'value' => $field['displayCount'], - 'layout' => 'verticle', - 'choices' => array( - 1 => __("Yes",'acf'), - 0 => __("No",'acf') - ) - )); - ?> - - - - - - ','',$field['value']); - echo ''; - - echo('
'); - - if(isset($field['displayCount'])){ - if($field['displayCount'] == 1){ - echo('
/ '.$field['character_number'].'
'); - }; - } - - } - - - /* - * input_admin_enqueue_scripts() - * - * This action is called in the admin_enqueue_scripts action on the edit screen where your field is created. - * Use this action to add css + javascript to assist your create_field() action. - * - * $info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts - * @type action - * @since 3.6 - * @date 23/01/13 - */ - - function input_admin_enqueue_scripts() - { - - - // register acf scripts - wp_register_script( 'acf-limiter', $this->settings['dir'] . 'js/limiter.js', array('acf-input'), $this->settings['version'] ); - - wp_register_style( 'jquery-ui-progressbar.min', $this->settings['dir'] . 'css/jquery-ui-progressbar.min.css', array('acf-input'), $this->settings['version'] ); - - wp_register_style( 'limiterCSS', $this->settings['dir'] . 'css/limiter.css', array('acf-input'), $this->settings['version'] ); - - - //jquery-ui-progressbar - wp_enqueue_script( 'jquery-ui-progressbar'); - - - // scripts - wp_enqueue_script(array( - 'acf-limiter', - )); - - // styles - wp_enqueue_style(array( - 'jquery-ui-progressbar.min','limiterCSS' - )); - - - } - - - /* - * input_admin_head() - * - * This action is called in the admin_head action on the edit screen where your field is created. - * Use this action to add css and javascript to assist your create_field() action. - * - * @info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head - * @type action - * @since 3.6 - * @date 23/01/13 - */ - - function input_admin_head() - { - // Note: This function can be removed if not used - - - - } - - - /* - * field_group_admin_enqueue_scripts() - * - * This action is called in the admin_enqueue_scripts action on the edit screen where your field is edited. - * Use this action to add css + javascript to assist your create_field_options() action. - * - * $info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts - * @type action - * @since 3.6 - * @date 23/01/13 - */ - - function field_group_admin_enqueue_scripts() - { - // Note: This function can be removed if not used - } - - - /* - * field_group_admin_head() - * - * This action is called in the admin_head action on the edit screen where your field is edited. - * Use this action to add css and javascript to assist your create_field_options() action. - * - * @info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head - * @type action - * @since 3.6 - * @date 23/01/13 - */ - - function field_group_admin_head() - { - // Note: This function can be removed if not used - } - - - /* - * load_value() - * - * This filter is appied to the $value after it is loaded from the db - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value - the value found in the database - * @param $post_id - the $post_id from which the value was loaded from - * @param $field - the field array holding all the field options - * - * @return $value - the value to be saved in te database - */ - - function load_value( $value, $post_id, $field ) - { - // Note: This function can be removed if not used - return $value; - } - - - /* - * update_value() - * - * This filter is appied to the $value before it is updated in the db - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value - the value which will be saved in the database - * @param $post_id - the $post_id of which the value will be saved - * @param $field - the field array holding all the field options - * - * @return $value - the modified value - */ - - function update_value( $value, $post_id, $field ) - { - // Note: This function can be removed if not used - return $value; - } - - - /* - * format_value() - * - * This filter is appied to the $value after it is loaded from the db and before it is passed to the create_field action - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value - the value which was loaded from the database - * @param $post_id - the $post_id from which the value was loaded - * @param $field - the field array holding all the field options - * - * @return $value - the modified value - */ - - function format_value( $value, $post_id, $field ) - { - // defaults? - /* - $field = array_merge($this->defaults, $field); - */ - - // perhaps use $field['preview_size'] to alter the $value? - - - // Note: This function can be removed if not used - return $value; - } - - - /* - * format_value_for_api() - * - * This filter is appied to the $value after it is loaded from the db and before it is passed back to the api functions such as the_field - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value - the value which was loaded from the database - * @param $post_id - the $post_id from which the value was loaded - * @param $field - the field array holding all the field options - * - * @return $value - the modified value - */ - - function format_value_for_api( $value, $post_id, $field ) - { - // defaults? - /* - $field = array_merge($this->defaults, $field); - */ - - // perhaps use $field['preview_size'] to alter the $value? - - - // Note: This function can be removed if not used - return $value; - } - - - /* - * load_field() - * - * This filter is appied to the $field after it is loaded from the database - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $field - the field array holding all the field options - * - * @return $field - the field array holding all the field options - */ - - function load_field( $field ) - { - // Note: This function can be removed if not used - return $field; - } - - - /* - * update_field() - * - * This filter is appied to the $field before it is saved to the database - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $field - the field array holding all the field options - * @param $post_id - the field group ID (post_type = acf) - * - * @return $field - the modified field - */ - - function update_field( $field, $post_id ) - { - // Note: This function can be removed if not used - return $field; - } - - -} - - -// create field -new acf_field_limiter(); - -?> diff --git a/limiter-v5.php b/limiter-v5.php deleted file mode 100755 index 8228dcf..0000000 --- a/limiter-v5.php +++ /dev/null @@ -1,629 +0,0 @@ -name = 'limiter'; - - - /* - * label (string) Multiple words, can include spaces, visible when selecting a field type - */ - - $this->label = __('Limiter', 'acf-limiter'); - - - /* - * category (string) basic | content | choice | relational | jquery | layout | CUSTOM GROUP NAME - */ - - $this->category = 'basic'; - - - /* - * defaults (array) Array of default settings which are merged into the field object. These are used later in settings - */ - - $this->defaults = array( - 'default_value' => '', - 'new_lines' => '', - 'character_number' => 150, - 'display_characters' => 1, - 'rows' => '', - 'placeholder' => '', - ); - - - /* - * l10n (array) Array of strings that are used in JavaScript. This allows JS strings to be translated in PHP and loaded via: - * var message = acf._e('limiter', 'error'); - */ - - $this->l10n = array( - 'error' => __('Error! Please enter a higher value', 'acf-limiter'), - ); - - - // do not delete! - parent::__construct(); - - } - - - /* - * render_field_settings() - * - * Create extra settings for your field. These are visible when editing a field - * - * @type action - * @since 3.6 - * @date 23/01/13 - * - * @param $field (array) the $field being edited - * @return n/a - */ - - function render_field_settings( $field ) { - - /* - * acf_render_field_setting - * - * This function will create a setting for your field. Simply pass the $field parameter and an array of field settings. - * The array of settings does not require a `value` or `prefix`; These settings are found from the $field array. - * - * More than one setting can be added by copy/paste the above code. - * Please note that you must also have a matching $defaults value for the field name (font_size) - */ - - // default_value - acf_render_field_setting( $field, array( - 'label' => __('Default Value','acf'), - 'instructions' => __('Appears when creating a new post','acf'), - 'type' => 'textarea', - 'name' => 'default_value', - 'rows' => 4 - )); - - - // placeholder - acf_render_field_setting( $field, array( - 'label' => __('Placeholder Text','acf'), - 'instructions' => __('Appears within the input','acf'), - 'type' => 'text', - 'name' => 'placeholder', - )); - - acf_render_field_setting( $field, array( - 'label' => __('Character Limit','acf'), - 'instructions' => __('How many characters would you like to limit','acf-limiter'), - 'type' => 'number', - 'name' => 'character_number', - 'append' => __('characters','acf-limiter') - )); - - acf_render_field_setting( $field, array( - 'label' => __('Display character limit','acf-limiter'), - 'instructions' => __('Show the number of characters left over the top of the progress bar.','acf-limiter'), - 'type' => 'radio', - 'name' => 'display_characters', - 'choices' => array( - 1 => __("No",'acf'), - 0 => __("Yes",'acf'), - ), - 'layout' => 'horizontal' - )); - - // rows - acf_render_field_setting( $field, array( - 'label' => __('Rows','acf'), - 'instructions' => __('Sets the textarea height','acf'), - 'type' => 'number', - 'name' => 'rows', - 'placeholder' => 4, - 'append' => __('textlines','acf-limiter') - )); - - // formatting - acf_render_field_setting( $field, array( - 'label' => __('New Lines','acf'), - 'instructions' => __('Controls how new lines are rendered','acf'), - 'type' => 'select', - 'name' => 'new_lines', - 'choices' => array( - 'wpautop' => __("Automatically add paragraphs",'acf'), - 'br' => __("Automatically add <br>",'acf'), - '' => __("No Formatting",'acf') - ) - )); - - } - - - - /* - * render_field() - * - * Create the HTML interface for your field - * - * @param $field (array) the $field being rendered - * - * @type action - * @since 3.6 - * @date 23/01/13 - * - * @param $field (array) the $field being edited - * @return n/a - */ - - function render_field( $field ) { - - /* - * Create a simple text input using the 'font_size' setting. - */ - - // rows - if ( empty($field['rows']) ) { - $field['rows'] = 4; - } - - // character limit - if ( empty($field['character_number']) || $field['character_number'] < 1 ) { - $character_number = 999999; - } else { - $character_number = $field['character_number']; - } - - - echo ''; - - echo('
'); - - if ( isset($field['display_characters']) ) { - if ( $field['display_characters'] == 0 ) { - echo('
/ '.$character_number.'
'); - } - } - } - - - /* - * input_admin_enqueue_scripts() - * - * This action is called in the admin_enqueue_scripts action on the edit screen where your field is created. - * Use this action to add CSS + JavaScript to assist your render_field() action. - * - * @type action (admin_enqueue_scripts) - * @since 3.6 - * @date 23/01/13 - * - * @param n/a - * @return n/a - */ - - - - function input_admin_enqueue_scripts() { - - $dir = plugin_dir_url( __FILE__ ); - - - // register & include JS - wp_register_script( 'acf-input-limiter', "{$dir}js/limiter.js" ); - - - - // register & include CSS - wp_register_style( 'acf-input-limiter', "{$dir}css/limiter.css" ); - - wp_register_style( 'jquery-ui-progressbar.min', "{$dir}css/jquery-ui-progressbar.min.css" ); - - - - - - - - //jquery-ui-progressbar - wp_enqueue_script(array( - 'acf-input-limiter','jquery-ui-progressbar' - )); - - // styles - wp_enqueue_style(array( - 'jquery-ui-progressbar.min','acf-input-limiter' - )); - - - - } - - - - - /* - * input_admin_head() - * - * This action is called in the admin_head action on the edit screen where your field is created. - * Use this action to add CSS and JavaScript to assist your render_field() action. - * - * @type action (admin_head) - * @since 3.6 - * @date 23/01/13 - * - * @param n/a - * @return n/a - */ - - /* - - function input_admin_head() { - - - - } - - */ - - - /* - * input_form_data() - * - * This function is called once on the 'input' page between the head and footer - * There are 2 situations where ACF did not load during the 'acf/input_admin_enqueue_scripts' and - * 'acf/input_admin_head' actions because ACF did not know it was going to be used. These situations are - * seen on comments / user edit forms on the front end. This function will always be called, and includes - * $args that related to the current screen such as $args['post_id'] - * - * @type function - * @date 6/03/2014 - * @since 5.0.0 - * - * @param $args (array) - * @return n/a - */ - - /* - - function input_form_data( $args ) { - - - - } - - */ - - - /* - * input_admin_footer() - * - * This action is called in the admin_footer action on the edit screen where your field is created. - * Use this action to add CSS and JavaScript to assist your render_field() action. - * - * @type action (admin_footer) - * @since 3.6 - * @date 23/01/13 - * - * @param n/a - * @return n/a - */ - - /* - - function input_admin_footer() { - - - - } - - */ - - - /* - * field_group_admin_enqueue_scripts() - * - * This action is called in the admin_enqueue_scripts action on the edit screen where your field is edited. - * Use this action to add CSS + JavaScript to assist your render_field_options() action. - * - * @type action (admin_enqueue_scripts) - * @since 3.6 - * @date 23/01/13 - * - * @param n/a - * @return n/a - */ - - /* - - function field_group_admin_enqueue_scripts() { - - } - - */ - - - /* - * field_group_admin_head() - * - * This action is called in the admin_head action on the edit screen where your field is edited. - * Use this action to add CSS and JavaScript to assist your render_field_options() action. - * - * @type action (admin_head) - * @since 3.6 - * @date 23/01/13 - * - * @param n/a - * @return n/a - */ - - /* - - function field_group_admin_head() { - - } - - */ - - - /* - * load_value() - * - * This filter is applied to the $value after it is loaded from the db - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value (mixed) the value found in the database - * @param $post_id (mixed) the $post_id from which the value was loaded - * @param $field (array) the field array holding all the field options - * @return $value - */ - - /* - - function load_value( $value, $post_id, $field ) { - - return $value; - - } - - */ - - - /* - * update_value() - * - * This filter is applied to the $value before it is saved in the db - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value (mixed) the value found in the database - * @param $post_id (mixed) the $post_id from which the value was loaded - * @param $field (array) the field array holding all the field options - * @return $value - */ - - /* - - function update_value( $value, $post_id, $field ) { - - return $value; - - } - - */ - - - /* - * format_value() - * - * This filter is appied to the $value after it is loaded from the db and before it is returned to the template - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value (mixed) the value which was loaded from the database - * @param $post_id (mixed) the $post_id from which the value was loaded - * @param $field (array) the field array holding all the field options - * - * @return $value (mixed) the modified value - */ - - function format_value( $value, $post_id, $field ) { - - // bail early if no value or not for template - if( empty($value) || !is_string($value) ) { - - return $value; - - } - - - // new lines - if( $field['new_lines'] == 'wpautop' ) { - - $value = wpautop($value); - - } elseif( $field['new_lines'] == 'br' ) { - - $value = nl2br($value); - - } - - - // return - return $value; - } - - - /* - * validate_value() - * - * This filter is used to perform validation on the value prior to saving. - * All values are validated regardless of the field's required setting. This allows you to validate and return - * messages to the user if the value is not correct - * - * @type filter - * @date 11/02/2014 - * @since 5.0.0 - * - * @param $valid (boolean) validation status based on the value and the field's required setting - * @param $value (mixed) the $_POST value - * @param $field (array) the field array holding all the field options - * @param $input (string) the corresponding input name for $_POST value - * @return $valid - */ - - /* - - function validate_value( $valid, $value, $field, $input ){ - - // Basic usage - if( $value < $field['custom_minimum_setting'] ) - { - $valid = false; - } - - - // Advanced usage - if( $value < $field['custom_minimum_setting'] ) - { - $valid = __('The value is too little!','acf-limiter'), - } - - - // return - return $valid; - - } - - */ - - - /* - * delete_value() - * - * This action is fired after a value has been deleted from the db. - * Please note that saving a blank value is treated as an update, not a delete - * - * @type action - * @date 6/03/2014 - * @since 5.0.0 - * - * @param $post_id (mixed) the $post_id from which the value was deleted - * @param $key (string) the $meta_key which the value was deleted - * @return n/a - */ - - /* - - function delete_value( $post_id, $key ) { - - - - } - - */ - - - /* - * load_field() - * - * This filter is applied to the $field after it is loaded from the database - * - * @type filter - * @date 23/01/2013 - * @since 3.6.0 - * - * @param $field (array) the field array holding all the field options - * @return $field - */ - - /* - - function load_field( $field ) { - - return $field; - - } - - */ - - - /* - * update_field() - * - * This filter is applied to the $field before it is saved to the database - * - * @type filter - * @date 23/01/2013 - * @since 3.6.0 - * - * @param $field (array) the field array holding all the field options - * @return $field - */ - - /* - - function update_field( $field ) { - - return $field; - - } - - */ - - - /* - * delete_field() - * - * This action is fired after a field is deleted from the database - * - * @type action - * @date 11/02/2014 - * @since 5.0.0 - * - * @param $field (array) the field array holding all the field options - * @return n/a - */ - - /* - - function delete_field( $field ) { - - - - } - - */ - - -} - - -// create field -new acf_field_limiter(); - -?> diff --git a/limiter-wysiwyg-v4.php b/limiter-wysiwyg-v4.php deleted file mode 100755 index 704e134..0000000 --- a/limiter-wysiwyg-v4.php +++ /dev/null @@ -1,310 +0,0 @@ -settings = array( - 'dir' => apply_filters('acf/helpers/get_dir', __FILE__) - ); - - - } - - - - function create_options( $field ) - { - - ?> - - - - -

Leave blank for unlimited characters

- - - 'text', - 'name' => 'fields['.$field['name'].'][character_number]', - 'value' => $field['character_number'] - )); - - ?> - - - "); - echo("
"); - - } - - - function input_admin_enqueue_scripts() - { - - - // register acf scripts - wp_register_script( 'acf-wysiwyg-limiter', $this->settings['dir'] . 'js/wysiwyg_limiter.js', array('acf-input'), $this->settings['version'] ); - - wp_register_style( 'jquery-ui-progressbar.min', $this->settings['dir'] . 'css/jquery-ui-progressbar.min.css', array('acf-input'), $this->settings['version'] ); - - //jquery-ui-progressbar - wp_enqueue_script( 'jquery-ui-progressbar'); - - - // scripts - wp_enqueue_script(array( - 'acf-wysiwyg-limiter', - )); - - // styles - wp_enqueue_style(array( - 'jquery-ui-progressbar.min', - )); - - - } - - function input_admin_head() - { - // Note: This function can be removed if not used - - - - } - - - /* - * field_group_admin_enqueue_scripts() - * - * This action is called in the admin_enqueue_scripts action on the edit screen where your field is edited. - * Use this action to add css + javascript to assist your create_field_options() action. - * - * $info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_enqueue_scripts - * @type action - * @since 3.6 - * @date 23/01/13 - */ - - function field_group_admin_enqueue_scripts() - { - // Note: This function can be removed if not used - } - - - /* - * field_group_admin_head() - * - * This action is called in the admin_head action on the edit screen where your field is edited. - * Use this action to add css and javascript to assist your create_field_options() action. - * - * @info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head - * @type action - * @since 3.6 - * @date 23/01/13 - */ - - function field_group_admin_head() - { - // Note: This function can be removed if not used - } - - - /* - * load_value() - * - * This filter is appied to the $value after it is loaded from the db - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value - the value found in the database - * @param $post_id - the $post_id from which the value was loaded from - * @param $field - the field array holding all the field options - * - * @return $value - the value to be saved in te database - */ - - function load_value( $value, $post_id, $field ) - { - // Note: This function can be removed if not used - return $value; - } - - - /* - * update_value() - * - * This filter is appied to the $value before it is updated in the db - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value - the value which will be saved in the database - * @param $post_id - the $post_id of which the value will be saved - * @param $field - the field array holding all the field options - * - * @return $value - the modified value - */ - - function update_value( $value, $post_id, $field ) - { - // Note: This function can be removed if not used - return $value; - } - - - /* - * format_value() - * - * This filter is appied to the $value after it is loaded from the db and before it is passed to the create_field action - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value - the value which was loaded from the database - * @param $post_id - the $post_id from which the value was loaded - * @param $field - the field array holding all the field options - * - * @return $value - the modified value - */ - - function format_value( $value, $post_id, $field ) - { - // defaults? - /* - $field = array_merge($this->defaults, $field); - */ - - // perhaps use $field['preview_size'] to alter the $value? - - - // Note: This function can be removed if not used - return $value; - } - - - /* - * format_value_for_api() - * - * This filter is appied to the $value after it is loaded from the db and before it is passed back to the api functions such as the_field - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $value - the value which was loaded from the database - * @param $post_id - the $post_id from which the value was loaded - * @param $field - the field array holding all the field options - * - * @return $value - the modified value - */ - - function format_value_for_api( $value, $post_id, $field ) - { - // defaults? - /* - $field = array_merge($this->defaults, $field); - */ - - // perhaps use $field['preview_size'] to alter the $value? - - - // Note: This function can be removed if not used - return $value; - } - - - /* - * load_field() - * - * This filter is appied to the $field after it is loaded from the database - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $field - the field array holding all the field options - * - * @return $field - the field array holding all the field options - */ - - function load_field( $field ) - { - // Note: This function can be removed if not used - return $field; - } - - - /* - * update_field() - * - * This filter is appied to the $field before it is saved to the database - * - * @type filter - * @since 3.6 - * @date 23/01/13 - * - * @param $field - the field array holding all the field options - * @param $post_id - the field group ID (post_type = acf) - * - * @return $field - the modified field - */ - - function update_field( $field, $post_id ) - { - // Note: This function can be removed if not used - return $field; - } - - - -} - - -new acf_field_wysiwyg_limited(); - -?> \ No newline at end of file diff --git a/readme.txt b/readme.txt old mode 100755 new mode 100644 index 389c134..0963f2d --- a/readme.txt +++ b/readme.txt @@ -1,20 +1,23 @@ === Advanced Custom Fields: Limiter Field === -Contributors: Atomicsmash -Tags: ACF, ACF3, ACF4, Advanced Custom Fields, Limiter, character number, word count -Requires at least: 3.0.1 -Tested up to: 3.5.1 -Stable tag: 4.3 +Contributors: Atomic Smash +Tags: ACF, ACF5, ACF4, Advanced Custom Fields, Limiter, character number, word count +Requires at least: 4.9.7 +Tested up to: 5.5.3 +Stable tag: trunk License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html -This plugin provides a textarea that limits the number of characters a user can add. The limit is cleanly represented by a jQuery UI progress bar. +Provides a textarea that limits the number of characters a user can add. The limit is cleanly represented by a jQuery UI progress bar. == Description == -__Works with ACF v4 and v5__ - This plugin provides an Advanced Custom Field textarea that limits the number of characters a user can add. The limit is cleanly represented by a jQuery Ui progress bar. You can define the number of characters on a per field basis. += Compatibility = + +This ACF field type is compatible with: +* ACF 5 +* ACF 4 This has been tested in: @@ -22,22 +25,20 @@ This has been tested in: * ACF - Flexible content fields * ACF - Option pages - == Installation == -1. Download the plugin -1. Extract zip and place plugin folder in /wp-content/plugins/ -1. Login into your wordpress installation and activate plugin - - -== Screenshots == - -1. This is the field in action. -1. These are it's options - +1. Copy the `acf-limiter` folder into your `wp-content/plugins` folder +2. Activate the Limiter plugin via the plugins admin page +3. Create a new field via ACF and select the Limiter type +4. Read the description above for usage instructions == Changelog == += 1.3.0 = +* Restructured plugin +* Fixed bug affecting field loading +* Removed support for ACF3 + = 1.2.1 = * Added composer.json