Wordpress Plugin
Description
The MF Datablocks Wordpress Widget is a plugin which lets you add one (or multiple) Datablocks widgets to your Wordpress site. It enables an easy way to embed various types of Datablocks data from MFN for a particular company, onto different sections of your site.
For example you can add news-lists, stock-charts, subscribe and other widget types which are available in Datablocks.
Releases zip-files of the plugin can be found at https://github.com/modfin/db-wp-plugin/releases
Installation
The simplest way to install the MF Datablocks Widget in Wordpress is to upload the plugin in the Wordpress Admin panel.
Start off by retrieving the WP plugin, from the link above.
Go to the Plugins
section in the WP dashboard, click the button 'Add new' and then 'Upload plugin'.
Browse the plugin .zip-file and install. After installation, click 'Enable plugin'.
If you instead want to do a manual installation, you can download the plugin zip-file, unzip the package contents and then upload the db-wp-widget-folder to {Yourwordpressfolder}/wp-content/plugins/
Once installed the plugin is visible in the Plugins section where you can activate it. When you click 'activate', the Widget will be visible under Appearance -> Widgets as 'MF Datablocks WP Widget'.
Composer
Composer (https://packagist.org/packages/modfin/db-wp-plugin)
Code at https://github.com/modfin/db-wp-plugin
Features
There are two ways in which the plugin enables you to add Datablocks data to your site:
By dragging and dropping the Widget to your desired site section. For example the Footer.
Or you can use the shortcode option, where you copy the shortcode from the Widget options and then add it directly into your posts.
The plugin widget loader allow multiple instances of Datablocks widgets placed on different sections on your site. So you can for example have a subscribe widget added to the Footer, and add a shortcode block for a stock-chart on the main page which will display simultaneously.
Usage
Option 1 - Drag and drop Widget
To start using the Widget, go to Appearance -> Widgets and drag the widget over into a desired section of your page.
You will see the following options appear in the widget
To properly display the data on your site you need to fill in the required information:
Widget type - The name of your Datablocks widget, for example stock-chart
Widget token - Your widget token
Locale: - The language of the Datablocks widget content. This will be automatically inherited from the language used in Wordpress, if the field is left empty.
Classname - (Optional) Adds a class to the widget main div to enable individual CSS styling for each widget instance from the Customization section in Wordpress.
Demo - (For demo / test usage) Will generate random data if checked and is not recommended in production.
Option 2 - Use the shortcode
Once you've dragged and dropped the widget into place in the Appearance -> Widgets and have filled in and saved the information, you will see that a shortcode has been populated automatically under Copy shortcode:
If you click on the input field, the shortcode will be selected as shown above - Then you can copy and paste it into a shortcode block to be embedded in your post:
Optional class in a widget shortcode
It is also possible add a unique classname to a shortcode widget instance by appending classname='{MyClassName}' to the shortcode like so:
[mfdb_widget type='Widget type' token='Widget token' locale='sv' classname='MyClassName']
This can be useful if you want to control CSS-styling for individual widgets.
Configuration
The MF Datablocks WP Widget adds a settings page in the WP dashboard where you can override the default Datablocks and JS Loader URL if needed. However, as the plugin already uses the correct URLs as default, there is normally no need to update these settings.
Last updated
Was this helpful?