An open API service indexing awesome lists of open source software.

https://github.com/guilamu/file-type-icons

Automatically adds customizable SVG icons to file links (PDF, Word, Excel, PowerPoint, TXT, etc.)
https://github.com/guilamu/file-type-icons

wordpress

Last synced: 5 days ago
JSON representation

Automatically adds customizable SVG icons to file links (PDF, Word, Excel, PowerPoint, TXT, etc.)

Awesome Lists containing this project

README

          

# File Type Icons

[![Latest Release](https://img.shields.io/github/v/release/guilamu/file-type-icons?color=blue)](https://github.com/guilamu/file-type-icons/releases) [![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0-green.svg)](LICENSE) [![WordPress: 7.0+](https://img.shields.io/badge/WordPress-7.0%2B-blue.svg)](https://wordpress.org) [![PHP: 8.0+](https://img.shields.io/badge/PHP-8.0%2B-purple.svg)](https://php.net)

Automatically adds customizable SVG icons to file links (PDF, Word, Excel, PowerPoint, TXT, etc.)

![Plugin Screenshot](https://github.com/guilamu/file-type-icons/blob/main/screenshot.png)

## Custom SVG Icons
- Display elegant vector graphics next to document links automatically.
- Colorize icons using HSL tailored colors directly from a modern Coloris color picker.
- Choose between Solid/Filled and Outline icon designs to match your style.
- Set responsive sizing and align icons to either the left or right of link text.

## Smart Link Exclusions
- Add the `no-fti` class to any anchor tag or container element to disable icons.
- Exclude whole blocks of content easily by wrapping them inside the `[no_fti]...[/no_fti]` shortcode.
- Toggle off icon rendering completely on specific pages via the editor sidebar metadata check.

## Key Features
- **Customizable:** Adjust colors, style presets, sizes, and layout choices instantly.
- **Lightweight:** Pure CSS-based mask-image presentation with zero javascript front-end libraries.
- **Multilingual:** Works with content in any language
- **Translation-Ready:** All strings are internationalized
- **Secure:** Enforces strict server sanitization and outputs clean, escaped inline styles.
- **GitHub Updates:** Automatic updates from GitHub releases

## Requirements
- WordPress 7.0 or higher
- PHP 8.0 or higher

## Installation
1. Upload the `file-type-icons` folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Go to **Settings → File Type Icons** and configure icon sizes, styles, positions, and active types.

## FAQ

### How do I change the color of an icon?
Go to the configuration page **Settings → File Type Icons** and use the color picker next to the desired file type.

### How do I disable icons on a specific page?
Check the **Disable icons on this page** box located in the editor sidebar (Document settings) when editing your page or post.

### How do I exclude specific links in the content?
Simply add the CSS class `no-fti` to your links or wrap the text containing the links with the shortcode `[no_fti]...[/no_fti]`.

### Can I customize the icon URL via code?
Yes, use the `fti_icon_url` filter:
```php
add_filter( 'fti_icon_url', function( $url, $type ) {
return $url;
}, 10, 2 );
```

### Can I disable the icon handler programmatically?
Yes, use the `fti_is_disabled` filter:
```php
add_filter( 'fti_is_disabled', function( $is_disabled ) {
return $is_disabled;
} );
```

## Project Structure
```
.
├── file-type-icons.php # Main plugin bootstrap file
├── uninstall.php # Database settings cleanup on uninstall
├── README.md # Documentation
├── assets
│ ├── css
│ │ ├── admin.css # Styles for settings options page
│ │ ├── coloris.min.css # Coloris library styles
│ │ └── frontend.css # Frontend layout structures
│ ├── js
│ │ ├── admin.js # Settings real-time preview sync script
│ │ └── coloris.min.js # Coloris library logic
│ └── icons
│ └── ... # Solid and outline SVG vector assets
├── includes
│ ├── class-admin-settings.php # Options registry and admin settings page
│ ├── class-disabler.php # Meta box and shortcode handler
│ ├── class-github-updater.php # GitHub automatic updater filter engine
│ ├── class-icon-handler.php # Frontend link parser and dynamic CSS injector
│ ├── class-plugin.php # Main bootstrap loader
│ └── Parsedown.php # PHP Markdown parser library dependency
└── languages
├── file-type-icons-fr_FR.mo # French translation compiled binary
├── file-type-icons-fr_FR.po # French translation source file
└── file-type-icons.pot # Main translation template
```

## Changelog

### 1.0.8 - 2026-06-15
- **Fix:** "View Details" link on plugins page now works correctly (plugin information API result now survives WordPress core filter mutations).

### 1.0.7 - 2026-06-11
- Bundled the admin settings icons locally so the settings UI no longer depends on an external CDN.

### 1.0.6 - 2026-06-11
- Added [no_fti] shortcode explanation in the Class Exclusions settings section.

### 1.0.5 - 2026-06-11
- Fixed updater metadata to report the plugin's tested WordPress version consistently.
- Hardened the per-post disable meta capability and nonce handling.
- Cleaned up the hover effect option on uninstall and switched admin asset versioning to the plugin version.
- Aligned the documented license references with the bundled AGPL license file.

### 1.0.4 - 2026-06-10
- Added customizable mouse hover effects (Lift and Zoom) for frontend file link icons with an interactive live settings preview.

### 1.0.3 - 2026-06-10
- Integrated the modern Coloris color picker into the admin settings page.

### 1.0.2 - 2026-06-10
- Added Style 3 ("Rounded" round gradient badge preset) with real-time settings page preview support.

### 1.0.1 - 2026-06-10
- Added Live Link Preview in general settings panel.

### 1.0.0 - 2026-06-10
- Initial stable release.

## Security

If you discover a security vulnerability in this plugin, please report it responsibly through [GitHub Security Advisories](https://github.com/guilamu/file-type-icons/security/advisories/new). Do not open a public issue for security reports.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request on [GitHub](https://github.com/guilamu/file-type-icons).

For translations, the plugin uses WordPress i18n. You can contribute translations by editing the `.po` files in the `languages/` directory and generating the corresponding `.mo` files with the `wp i18n` CLI commands.

## Credits

- [Coloris](https://github.com/mdbassit/Coloris) - A lightweight, responsive, and dependency-free color picker library by Momo Bassit (MIT License).

## License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) — see the [LICENSE](LICENSE) file for details.

---

Made with love for the WordPress community