Skip to content

Icon field type for CMB2. Supports local directories of icons and external URLs containing <img> and <a> links

License

Notifications You must be signed in to change notification settings

anewholm/cmb2-field-icon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMB2 Field Icon

Allow icon selection for a post from:

  1. local directories: THIS_PLUGIN_PATH . 'public/assets/images' The code will recurse all sub-directories also
  2. remote webpages: http://www.flaticon.com/packs/holiday-travelling-3 The code will check all a and img tags in the remote webpage for images
  3. upload directories: wp_upload_dir()['path']

Installation

Composer

composer require anewholm/cmb2-field-icon

Manual

  1. Download the plugin
  2. Place the plugin folder in your /wp-content/plugins/ directory
  3. Activate the plugin in the plugins dashboard

Usage

array(
  'id' => $prefix . 'location_metabox_icon',
  'title' => __( 'Icon', $plugin_slug ),
  'object_types' => array( $post_type, ), // Post type
  'context' => 'side',
  'priority' => 'high',
  'show_names' => false,
  'fields' => array(        
    array(
      'name' => __( 'Icon', $plugin_slug ),
      'id' => $plugin_slug . '_location_icon',
      'type' => 'icon',
      'desc' => 'Used in Maps.',
      'options' => array(
        'paths' => array( 
          THIS_PLUGIN_PATH . 'public/assets/images',
          wp_upload_dir()['path'], // Since 2.0.0
          'http://www.flaticon.com/packs/holiday-travelling-3',
        ),
      ),
    ),
  ),      
),

About

Icon field type for CMB2. Supports local directories of icons and external URLs containing <img> and <a> links

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published