Linux 软件免费装
Banner图

Mudrava Icon Field for ACF with Lucide

开发者 mudrava
更新时间 2026年9月1日 19:25
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPL-2.0-or-later
版权网址: 版权信息

标签

icons acf brands icon picker lucide

下载

1.0.0 1.1.0 1.2.0

详情介绍:

Mudrava Icon Field for ACF with Lucide adds a new field type to Advanced Custom Fields (ACF) that allows users to select icons from the Lucide icon library and brand logos from Simple Icons through an intuitive visual picker. The selected icon value is stored in the database, making it lightweight and flexible for frontend rendering. Requirements: This plugin requires Advanced Custom Fields (ACF) version 6.0 or higher to function. Features Usage After installing both ACF and this plugin:
  1. Go to Custom Fields > Add New
  2. Add a new field and select Lucide Icon as the field type
  3. Configure the field settings (default value, return format, etc.)
  4. Save your field group
Template Examples Get Icon Name: <?php $icon_name = get_field('your_field_name'); echo esc_html($icon_name); // Returns: 'rocket' ?> Get SVG Markup (with return_format = 'svg'): <?php $icon_svg = get_field('your_field_name'); echo $icon_svg; // Returns: <svg>...</svg> ?> Using the Helper Function: `<?php // Basic usage echo mudrava_get_lucide_icon('rocket'); // With custom attributes echo mudrava_get_lucide_icon('rocket', [ 'class' => 'my-custom-class', 'width' => 32, 'height' => 32, 'stroke' => '#ff0000', 'title' => 'Launch', // accessible title 'mode' => 'sprite', // 'inline' (default) or 'sprite' ]); ?>` Shortcode [lucide_icon name="rocket" size="32" title="Launch"] Custom icons uploaded under Settings → Custom Icons are addressed as custom:<name>, for example [lucide_icon name="custom:my-logo" title="My Logo"] or mudrava_get_lucide_icon( 'custom:my-logo' ). About Custom SVG Icons Site owners can upload plain SVG icons under Settings → Custom Icons. Uploads are parsed with DOMDocument (no network access) and reduced to the same element and attribute allowlist as the bundled sets via wp_kses(), so scripts, styles, embedded images and unsupported elements never reach storage. Custom icons are stored as standalone files in the uploads directory, appear in the picker search, and render with their own colors instead of a forced currentColor tint. About Lucide Icons Lucide is a modern, open-source icon library with 1,700+ carefully crafted icons. The bundled Lucide assets are from lucide-static 1.38.0 and are licensed under ISC. About Brand Icons Brand logos are bundled separately from Simple Icons 16.29.0 and are saved with the simple: prefix, for example simple:facebook. Simple Icons is distributed under CC0-1.0, but individual brand logos and trademarks may still be governed by each brand owner's guidelines and permissions. Check the relevant brand guidelines before using a logo in production. Source and guideline URLs from Simple Icons are bundled in data/brand-icons-meta.json.

安装:

Requirements Before installing this plugin, ensure you have: Installation Steps
  1. Install and activate ACF (if not already installed)
  2. Upload the mudrava-acf-lucide-field folder to /wp-content/plugins/
  3. Activate the plugin through the 'Plugins' menu in WordPress
  4. The new "Lucide Icon" field type will appear in ACF field type selection
Via WordPress Admin
  1. Go to Plugins > Add New > Upload Plugin
  2. Upload the plugin zip file
  3. Click Install Now and then Activate

升级注意事项:

1.2.0 Updates bundled icon libraries to lucide-static 1.38.0 and simple-icons 16.29.0, reworks the admin picker to load lazily over REST, and makes unknown icon values non-blocking by default. Saved values are never rewritten; removed upstream icons are aliased to their canonical replacements. 1.1.0 Updates Lucide to 1.14.0 and moves brand logos to a separate Simple Icons bundle. New brand values use simple:<slug>; legacy social values are resolved automatically where possible. 1.0.1 Fixes frontend icon rendering reliability, especially on sites using CDN, HTTPS/domain rewrites, CSP, or optimization plugins. Also documents Lucide v1 brand icon changes. 1.0.0 Initial release of Mudrava Icon Field for ACF with Lucide.

常见问题:

Do I need ACF Pro for this plugin to work?

No. The field type works with Advanced Custom Fields 6.0 or higher. It also works inside ACF Pro field groups such as Repeaters and Flexible Content.

Will the plugin work if I deactivate ACF?

No, the plugin will show an admin notice and the field type will not be available. You must keep ACF active.

Does this plugin make external requests?

No. All icon data is stored locally in the plugin files. No external API calls or CDN requests are made.

Where are the icons stored?

Lucide SVG data is bundled in assets/sprite.svg. Brand logo SVG data is bundled in assets/brand-sprite.svg. Search metadata is built into data/icons.json, data/brand-icons.json, data/lucide-tags.php, data/simple-tags.php and byte-offset lookups in data/lucide-index.php and data/simple-index.php. The admin picker loads the catalog lazily through a local REST endpoint (wp-json/mudrava-lucide/v1/icons, logged in by default). Everything runs locally on your server.

Why did social or brand icons disappear after updating Lucide assets?

Lucide v1 removed most brand icons from the current packages. Version 1.1.0 updates Lucide to lucide-static 1.14.0 and adds a separate Simple Icons brand bundle, which is the recommended direction for brand logos. New brand values are saved as simple:<slug>, and legacy unprefixed social values such as facebook, instagram, twitter, or youtube are resolved against Simple Icons when they no longer exist in Lucide.

What happens if an icon name was removed in a library update?

Saved values are never rewritten. Icons removed in lucide-static 1.38.0 (angry, annoyed, frown, history, laugh, meh, podcast, smile, smile-plus) are mapped to canonical replacements in data/compat-aliases.json, for example smile renders as face-slightly-smiling. Unknown values that have no alias keep saving and surface as a dismissible admin notice; set the field setting "Unknown Icon Values" to "error" to make validation strict instead.

Can I use this with ACF Repeater or Flexible Content fields?

Yes, the Lucide Icon field works perfectly within Repeater fields, Flexible Content fields, and any other ACF field groups.

What format does the field return?

You can configure the return format in the field settings:

  • Icon Name - Returns the icon value as a string (e.g., "rocket" or "simple:facebook")
  • SVG Markup - Returns the complete SVG HTML code

How do I customize the icon appearance?

Use the mudrava_get_lucide_icon() helper function with custom attributes for width, height, stroke color, fill color, and CSS classes.

Is the plugin translation-ready?

Yes, the plugin is fully translation-ready with text domain mudrava-acf-lucide-field. Translation files should be placed in the /languages/ directory.

更新日志:

1.2.0 - 2026-08-31 1.1.0 - 2026-04-30 1.0.1 - 2026-04-30 1.0.0 - 2026-03-07