PHPackages                             serkanalgur/cmb2-field-faiconselect - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. serkanalgur/cmb2-field-faiconselect

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

serkanalgur/cmb2-field-faiconselect
===================================

Font Awesome icon selector for powerful custom metabox generator CMB2

1.4(6y ago)202.2k↓33.3%5[2 issues](https://github.com/serkanalgur/cmb2-field-faiconselect/issues)GPL-3.0-or-laterPHPPHP &gt;5.6

Since Jun 30Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/serkanalgur/cmb2-field-faiconselect)[ Packagist](https://packagist.org/packages/serkanalgur/cmb2-field-faiconselect)[ Docs](https://github.com/serkanalgur/cmb2-field-faiconselect)[ RSS](/packages/serkanalgur-cmb2-field-faiconselect/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (2)Used By (0)

CMB2 Field Type: Font Awesome
=============================

[](#cmb2-field-type-font-awesome)

#### Font Awesome Icon Selector for CMB2

[](#font-awesome-icon-selector-for-cmb2)

[![FOSSA Status](https://camo.githubusercontent.com/92f2f7264b70860cfa83df0fb313a8432530c28db2b262fa56552faea9563b3c/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532467365726b616e616c677572253246636d62322d6669656c642d666169636f6e73656c6563742e7376673f747970653d736869656c64)](https://app.fossa.io/projects/git%2Bgithub.com%2Fserkanalgur%2Fcmb2-field-faiconselect?ref=badge_shield)

Description
-----------

[](#description)

Font Awesome icon selector for powerful custom metabox generator [CMB2](https://github.com/WebDevStudios/CMB2 "Custom Metaboxes and Fields for WordPress 2")

You can use as field type in CMB2 function file. Add a new field, set type to `faiconselect` and add font awesome icons to options (look Usage for examples). Plugin uses [jQuery Font Picker](https://codeb.it/fonticonpicker/) for creating a icon selector.

Plugin capable to use Font Awesome 4.7.0 or 5.7.2 (only Solid and Brands icons) for icons and selector.

### WordPress Plugin

[](#wordpress-plugin)

You can download this plugin also here : [CMB2 Field Type: Font Awesome](https://wordpress.org/plugins/cmb2-field-type-font-awesome/)or you can search as `CMB2 Field Type: Font Awesome` on your plugin install page.

### Install via Composer

[](#install-via-composer)

This plugin available as [Composer Package](https://packagist.org/packages/serkanalgur/cmb2-field-faiconselect) and can be installed via Composer.

```
composer require serkanalgur/cmb2-field-faiconselect
```

### ScreenShot

[](#screenshot)

[![Image](screenshot-1.png?raw=true)](screenshot-1.png?raw=true)

Usage
-----

[](#usage)

Download this repo and put files into `wp-content/plugins/` directory. When you enable plugin, you can use field type in CMB2.

Alternatively you can search `CMB2 Field Type: Font Awesome` on WordPress plugin directory.

Use `faiconselect` for type. For Example;

```
$cmb->add_field( array(
    'name' => __( 'Select Font Awesome Icon', 'cmb' ),
    'id'   => $prefix . 'iconselect',
    'desc' => 'Select Font Awesome icon',
    'type' => 'faiconselect',
    'options' => array(
	'fa fa-facebook' => 'fa fa-facebook',
	'fa fa-500px'  	 => 'fa fa-500px',
	'fa fa-twitter'	 => 'fa fa-twitter'
    )
) );
```

After that jQuery Font Picker plugin handle the select.

Aslo you can use predefined array for Font Awesome. I created a function with this addon to use in `options_cb`. Function called as `returnRayFaPre`.

```
$cmb->add_field( array(
    'name' => __( 'Select Font Awesome Icon', 'cmb' ),
    'id'   => $prefix . 'iconselect',
    'desc' => 'Select Font Awesome icon',
    'type' => 'faiconselect',
    'options_cb' => 'returnRayFaPre'
) );
```

Usage From Template Folder
--------------------------

[](#usage-from-template-folder)

Download and place folder into your theme folder. You need to create a function for fixing asset path issue. Fore example;

```
// Fix for $asset_path issue
function asset_path_faiconselect() {
    return get_template_directory_uri() . '/path/to/folder'; //Change to correct path.
}

add_filter( 'sa_cmb2_field_faiconselect_asset_path', 'asset_path_faiconselect' );

//Now call faiconselect
require get_template_directory() . '/path/to/folder/iconselect.php'; //Again Change to correct path.
```

This function solve assetpath issue for including javascript and css files.

Usage With Font Awesome 5
-------------------------

[](#usage-with-font-awesome-5)

You need two different options for activate Font Awesome 5. You will need to add an attribute. Also there is a function for predefined list of font-awesome 😄

#### Standart Way

[](#standart-way)

```
$cmb->add_field( array(
    'name' => __( 'Select Font Awesome Icon', 'cmb' ),
    'id'   => $prefix . 'iconselect',
    'desc' => 'Select Font Awesome icon',
    'type' => 'faiconselect',
    'options' => array(
        'fab fa-facebook' => 'fa fa-facebook',
        'fab fa-500px'  	 => 'fa fa-500px',
        'fab fa-twitter'	 => 'fa fa-twitter',
        'fas fa-address-book' => 'fas fa-address-book'
    ),
    'attributes' => array(
        'faver' => 5
    )
) );
```

This attribute needed for selecting right style files. If you don't add these attribute, you can not see icons.

#### Predefined Way

[](#predefined-way)

```
$cmb->add_field( array(
    'name' => __( 'Select Font Awesome Icon', 'cmb' ),
    'id'   => $prefix . 'iconselect',
    'desc' => 'Select Font Awesome icon',
    'type' => 'faiconselect',
    'options_cb' => 'returnRayFapsa',
    'attributes' => array(
        'faver' => 5
    )
) );
```

As you can see we define an `options_cb` function named `returnRayFapsa`. This function create an array for options with `solid` and `brands` icons. Also you need `faver` attribute for Font Awesome 5.

That's All for now 😄 Contributions are welcome

You can donate me via;

Paypal :

License
-------

[](#license)

[![FOSSA Status](https://camo.githubusercontent.com/ed05051b6525185df5088997fa3dfcafb7ca3613d2822e03c2d67dbcf71f17f0/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d2532467365726b616e616c677572253246636d62322d6669656c642d666169636f6e73656c6563742e7376673f747970653d6c61726765)](https://app.fossa.io/projects/git%2Bgithub.com%2Fserkanalgur%2Fcmb2-field-faiconselect?ref=badge_large)

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance55

Moderate activity, may be stable

Popularity29

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2508d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c0bdaace73a06876c30b91f86f99e206c4a8fe5bb7a1a1e91f159a5e2c98088?d=identicon)[serkanalgur](/maintainers/serkanalgur)

---

Top Contributors

[![serkanalgur](https://avatars.githubusercontent.com/u/353690?v=4)](https://github.com/serkanalgur "serkanalgur (38 commits)")[![fossabot](https://avatars.githubusercontent.com/u/29791463?v=4)](https://github.com/fossabot "fossabot (1 commits)")

---

Tags

cmb2font-awesomewordpresswordpress-plugin

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/serkanalgur-cmb2-field-faiconselect/health.svg)

```
[![Health](https://phpackages.com/badges/serkanalgur-cmb2-field-faiconselect/health.svg)](https://phpackages.com/packages/serkanalgur-cmb2-field-faiconselect)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
