PHP code example of smithfield-studio / acf-svg-icon-picker
1. Go to this page and download the library: Download smithfield-studio/acf-svg-icon-picker library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
smithfield-studio / acf-svg-icon-picker example snippets
use function SmithfieldStudio\AcfSvgIconPicker\get_svg_icon_uri;
use function SmithfieldStudio\AcfSvgIconPicker\get_svg_icon_path;
use function SmithfieldStudio\AcfSvgIconPicker\get_svg_icon;
$my_icon_field = get_field('my_icon_field');
// Get the icon URL
$icon_url = get_svg_icon_uri($my_icon_field);
// Get the icon file system path
$icon_path = get_svg_icon_path($my_icon_field);
// Get the icon contents
$icon_svg = get_svg_icon($my_icon_field);
// modify the path to the icons directory in your theme.
add_filter('acf_svg_icon_picker_folder', function () {
return 'resources/icons/';
});