Search and add Widen digital assets to your WordPress media library.
This WordPress plugin lets users search for images in Widen and add them to their site's media library. This plugin does not download media from Widen but rather creates a new WordPress media attachment that refers to the Widen asset URL. Some additional Widen metadata is captured and saved to the database on the "Add to Media Library" action. This plugin does not currently support syncing of meta data between Widen & WordPress.
You can either download a release zip and install via the WordPress plugin installer or via composer.
composer require masonitedoors/widen-media
This plugin uses V2 of the Widen API. You will need to define your Widen API access token in wp-config.php
.
define( 'WIDEN_MEDIA_ACCESS_TOKEN', 'my-widen-api-token' );
Some additional Widen metadata is captured and saved to the database on the Add to Media Library
action. This plugin does not currently support syncing of meta data between Widen & WordPress.
This plugin saves Widen collections under the post type wm_collection
in order to provide a way for other themes and plugins to have access to this data without having to directly interact with Widen's API.
Within the main search page under "Add New", users can toggle "collection" when searching Widen. This will return only results that match that collection name.
When searching for a collection, a Save Collection button will be displayed. This button saves the current result page's collection to the metadata of a new post under the wp_collection
post type. Note that a collection large than 100 assets will only save the 100 assets on the current results page.
This plugin ships with some default image sizes however a filter has been included if you wish to change those defined sizes from within another plugin or theme.
Example function defining 2 image sizes:
function filter_defined_image_sizes( $default_image_sizes ) {
$sizes = [
'banner-sm' => [
'label' => __( 'Small Banner', 'textdomain' ),
'width' => 820,
'height' => 312,
],
'banner-lg' => [
'label' => __( 'Large Banner', 'textdomain' ),
'width' => 1500,
'height' => 500,
],
];
// Uncomment to append sizes to the plugin's already defined sizes.
// $sizes = array_merge( $sizes, $default_image_sizes );
return $sizes;
}
add_filter( 'wm_defined_image_sizes', 'filter_defined_image_sizes', 10, 1 );
This plugin provides some function to allow other plugins to easly interact with Widen data imported into WordPress as well as the Widen API.
Returns an array of collection objects.
Returns the collection object.
Returns all the fields from Widen for an asset that exists within the WordPress Media Library.
Returns a single field for a Widen asset that exists within the WordPress Media Library.