Integrating Distributed Media Lab’s Viewer with WordPress

Distributed Media Lab’s Viewer installs quickly into any existing WordPress installation. There are only two parts, the first is a very lightweight plugin that will make access to our Viewer available on all of your WordPress pages and posts. The second part is to place one line of html code into your pages or posts wherever you want the DML “stack” to appear for your users to see.


Part One: Install Link to the DML Viewer Script

This can be done one of two ways, either install our WordPress plugin, or manually add a line to your functions.php file.


Install our WordPress Plugin (Recommended)

  1. Download the Distributed Media Lab Viewer plugin here.
  2. In your WordPress Admin Console, chose ‘Plugins -> Add New’ from the left nav menu. Click the ‘Upload Plugin’ button in the header, and use the ‘choose File’ button provided to locate the plugin you downloaded to your computer in step 1. Then Click ‘Install Now’.
  3. Once the plugin is successfully installed, click the ‘Activate’ link in WordPress. This will not change anything about the appearance of your site, it will only enable your site to have access to DML’s Viewer technology via a script that will only run if it is triggered in a page. Otherwise it will be dormant and will not have any affect on your site.


(OR) install manually (for Advanced Users)

  1. Open your theme’s function.php file and paste in the following code to ‘enqueue’ the DML script in your site.

function dml_embed_widget_enqueue_script() {
wp_enqueue_script( 'dml_embed_script',‘https://c.go-fet.ch/a/embed.js', array(), '1.0.0', true );
}
add_action('wp_enqueue_scripts', 'dml_embed_widget_enqueue_script’);</code>


Part Two: Enable a DML Viewer on a Page or Post

Enabling a DML Viewer on a page is simple. It requires one line of html to be placed wherever you would like the DML stack to appear.

Copy the following line and paste it into your page where you want the viewer stack to appear, changing out the [yourCollectionIdHere] placeholder with the ID for your collection. This was either provided to you by DML or you can find it in the DML Hub at hub.distributedmedialab.com

 

Once this has been placed, save your page or post and preview it. You should see the DML stack with up to 4 articles appearing in “cards” either in a row or a column depending on the width of the container you placed it in. Click on any of the articles to make sure you see the DML article viewer experience appearing.