Git Product home page Git Product logo

acf-icon-picker's Introduction

ACF Icon Selector Field

Allows you to create an 'icon-picker' acf-field.


Please note

I am no longer developing this plugin myself, but will still be accepting PRs.

Description

Add the svg icons you want to be available in your theme to an acf folder inside an img folder in your theme. The field returns the name of the svg.

Compatibility

This ACF field type is compatible with:

[x] ACF 6 [x] ACF 5

Screenshots

Icon Picker

Installation

via Composer

  1. Add a line to your repositories array: { "type": "git", "url": "https://github.com/houke/acf-icon-picker" }
  2. Add a line to your require block: "houke/acf-icon-picker": "dev-master"
  3. Run: composer update

Manually

  1. Copy the acf-icon-picker folder into your wp-content/plugins folder
  2. Activate the Icon Selector plugin via the plugins admin page
  3. Create a new field via ACF and select the Icon Selector type

Filters

Use the below filters to override the default icon folder, path, and / or URL:

// modify the path to the icons directory
add_filter( 'acf_icon_path_suffix', 'acf_icon_path_suffix' );

function acf_icon_path_suffix( $path_suffix ) {
    return 'assets/img/icons/';
}

// modify the path to the above prefix
add_filter( 'acf_icon_path', 'acf_icon_path' );

function acf_icon_path( $path_suffix ) {
    return plugin_dir_path( __FILE__ );
}

// modify the URL to the icons directory to display on the page
add_filter( 'acf_icon_url', 'acf_icon_url' );

function acf_icon_url( $path_suffix ) {
    return plugin_dir_url( __FILE__ );
}

For Sage/Bedrock edit filters.php:

/// modify the path to the icons directory
add_filter('acf_icon_path_suffix',
  function ( $path_suffix ) {
    return '/assets/images/icons/'; // After assets folder you can define folder structure
  }
);

// modify the path to the above prefix
add_filter('acf_icon_path',
  function ( $path_suffix ) {
    return '/app/public/web/themes/THEME_NAME/resources';
  }
);

// modify the URL to the icons directory to display on the page
add_filter('acf_icon_url',
  function ( $path_suffix ) {
    return get_stylesheet_directory_uri();
  }
);

Changelog

  • 1.9.1 - ACF 6 compatibility fix. Thanks to idflood
  • 1.9.0 - Fix issue with Gutenberg preview not updating when removing. Thanks to cherbst
  • 1.8.0 - Fix issue with Gutenberg not saving icon. Thanks to tlewap
  • 1.7.0 - 2 new filters for more control over icon path. Thanks to benjibee
  • 1.6.0 - Performance fix with lots of icons. Thanks to idflood
  • 1.5.0 - Fix issue where searching for icons would break preview if icon name has space
  • 1.4.0 - Add filter to change folder where svg icons are stored
  • 1.3.0 - Adding close option on modal
  • 1.2.0 - Adding search filter input to filter through icons by name
  • 1.1.0 - Add button to remove the selected icon when the field is not required
  • 1.0.0 - First release

acf-icon-picker's People

Contributors

cherbst avatar dbiljak avatar houke avatar idflood avatar klaudiomilankovic avatar marcbelletre avatar tlewap avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.