PHPackages                             dutchigor/cmb2-image-map - 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. dutchigor/cmb2-image-map

ActiveWordpress-plugin

dutchigor/cmb2-image-map
========================

Adds image map field to CMB2, This allows a marker to be set on each field on top of a pre-defined image or map layer.

v0.4.0(6y ago)17GPL-3.0-or-laterPHPPHP &gt;7.0.0

Since Mar 31Pushed 6y ago2 watchersCompare

[ Source](https://github.com/dutchigor/CMB2-image-map)[ Packagist](https://packagist.org/packages/dutchigor/cmb2-image-map)[ Docs](https://github.com/dutchigor/CMB2-image-map)[ RSS](/packages/dutchigor-cmb2-image-map/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (6)Used By (0)

CMB2-Image-Map
==============

[](#cmb2-image-map)

**Note: This plugin is still under development**

Adds image map field to CMB2, This allows a marker to be set on each field on top of a pre-defined image or map layer.

Requires [CMB2](https://github.com/CMB2/CMB2) to be added to WordPress seperately.

Each field can contain one marker and will store the coordinates of that marker. Clicking anywhere on the map will place or move the marker there.

How to install
--------------

[](#how-to-install)

Option one

- Download the latest release (CMB2-image-map.zip from releases &gt; assets) and Install as a standard WordPress plugin

Option two

- Add dutchigor/cmb2-image-map to required packages in composer and require CMB2-image-map.php in your code

How to use
----------

[](#how-to-use)

### Creating a field

[](#creating-a-field)

Create a field with type 'image\_map' and give it the following properties:

- base\_layer: String / Int - If base\_type is 'map, The url template for the basemap you wish to use. If base\_type is 'image', the id of the attachment to use as the image layer. (manditory)
- base\_type: String - 'image' to use an image overlay or map to use a geographical basemap. Defaults to 'map'. (optional)
- base\_lat: Int - The latitute to center the map on if no marker is set yet. (optional)
- base\_lng: Int - The longitude to center the map on if no marker is set yet. (optional)
- base\_zoom: Int - The zoom level with which the map will be initialized on the field. If not provided the whole image will be shown and centered for an image overlay. (optional)
- map\_options: Array - This array will be converted to a javascript object and used to load the map. For possible values see Options in . (optional)
- layer\_options: Array - This array will be converted to a javascript object and used to load the baselayer. Only applicable for base\_type 'map'. For possible values see Options in . (optional)

#### Example

[](#example)

This is an example of a map field using mapbox

```
$cmb = new_cmb2_box( array(
    'id'            => 'image_map_metabox',
    'title'         => 'Example',
    'object_types'  => array( 'post' ),
 ) );

$cmb->add_field( array(
    'id'            => 'my_img_map',
    'name'          => 'Test Image Map',
    'type'          => 'image_map',
    'base_type'     => 'map',
    'base_layer'    => 'https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}'
    'base_lat'      => 60.1699,
    'base_lng'      => 24.9384,
    'layer_options' => array(
        'accessToken'   => 'your-token-here',
        'id'            => 'mapbox/streets-v11',
        'tileSize'      => 512,
        'zoomOffset'    => -1,
    ),
    'map_options'   => array(
        'maxZoom'       => 18,
    )
) );
```

### Displaying results

[](#displaying-results)

The results are stored in the custom field as an array with a lat and lng value. They can be displayed on a map on the front with E.g. the [Flexible Map plugin](https://flexible-map.webaware.net.au/).

#### Example

[](#example-1)

```
$coordinates = get_post_meta( $post->ID, 'my_img_map', true )
flexmap_show_map([
  'center' => $coordinates['lat'] . ',' . $coordinates['lng']
]);
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Every ~0 days

Total

5

Last Release

2230d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5fff5875562d3020e371c914420d0f293a4f2e53e2c6d328ce0b7c712902c259?d=identicon)[dutchigor](/maintainers/dutchigor)

---

Top Contributors

[![dutchigor](https://avatars.githubusercontent.com/u/38113768?v=4)](https://github.com/dutchigor "dutchigor (15 commits)")

---

Tags

wordpressmapCMB2

### Embed Badge

![Health badge](/badges/dutchigor-cmb2-image-map/health.svg)

```
[![Health](https://phpackages.com/badges/dutchigor-cmb2-image-map/health.svg)](https://phpackages.com/packages/dutchigor-cmb2-image-map)
```

###  Alternatives

[chdemko/sorted-collections

Sorted Collections for PHP &gt;= 8.2

222.5M3](/packages/chdemko-sorted-collections)[jtsternberg/shortcode-button

Tinymce and Quicktag buttons (and modals) for outputting shortcodes. Built to work with CMB2.

781.3k1](/packages/jtsternberg-shortcode-button)[webdevstudios/cmb2-user-select

Special CMB2 Field that allows users to define an autocomplete text field for users

211.3k1](/packages/webdevstudios-cmb2-user-select)

PHPackages © 2026

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