Allows you to create an 'icon-picker' acf-field.
I am no longer developing this plugin myself, please use https://github.com/smithfield-studio/acf-svg-icon-picker instead.
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.
This ACF field type is compatible with:
{ "type": "git", "url": "https://github.com/houke/acf-icon-picker" }
"houke/acf-icon-picker": "dev-master"
composer update
acf-icon-picker
folder into your wp-content/plugins
folderUse 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();
}
);