Skip to main content
  1. All Posts/

WordPress_Publishing_Tool

Tools Open Source PHP WordPress

Publishing tool for MATLAB® live script to WordPress


This MATLAB® App provides a fast and easy way for users to publish their MATLAB® live scripts as blog posts to their WordPress sites. What the users type in live script is what the users will see in WordPress.
The App will:

  1. Keeps all the styles in the live script as well as outputs such as graphs and tables and convert entire live script into HTML markup and send to WordPress via WordPress JSON API.
  2. All the images in the live script will be converted to media files and uploaded to WordPress automatically.
  3. The animation output will be automatically converted into GIF files and uploaded to WordPress automatically.
  4. All the equations and formulas will be rendered nicely via MathJax in WordPress.
  5. Users also have the option to let the app upload their original live script as attachment for readers to download or not from their WordPress site.

Setup

Prerequisite

  • Be connected to internet

MathWorks® Products (http://www.mathworks.com)

  • Requires MATLAB® release R2020a or newer

3rd Party Products:

  • WordPress V4.7 and above with WP JSON API enabled
    • Update the setting of permalink to not be plain
  • Have JWT Authentication for WP REST API (preferred) or Basic Authentication installed and configured in your WordPress site

Deployment Steps

MATLAB®

  1. Get wp_publisher.mlapp and convertScript.p in your workspace
  1. Add wp_publisher MATLAB® App directory into your MATLAB® path permanently

WordPress

  1. Upload live-script-support to your WordPress plugin (/wp-content/plugins)
  2. Activate Live Script Support plugin:

Getting Started

According to your habits, you can create a folder for all your blog post live scripts, or a folder for all your blog post live scripts for a particular year (e.g. 2021_blog_posts).

Note: If you are not in your blog post folder, please close the publishing tool, go to your blog post folder with live scripts and reopen the App.

First time user

  • Go to your blog post folder with live scripts
  • In MATLAB® Command Window, simply type wp_publisher:
  • The publishing tool will be opened and lead you to the settings tab, where you can input your WordPress blog site information.
    • You also can choose the location to store the output files for your blog post live script
    • Choose your installed WordPress API authentication
    • Save your settings and your blog information will be saved in your workspace
  • Switch to Publish post tab, you will see a dropdown menu to choose the live script you want to post as article to your WordPress blog
  • You can check “Allow your readers to download your source Live Script” and your live script will be uploaded to your WordPress media library for users to download
  • Once you finish choosing your blog post, click Publish draft button, your live script will be posted to your WordPress as a draft.
    • The link to the draft of your post will be displayed in your MATLAB® Command Window (you need to log in your WordPress to see the draft)
  • You can preview the post, once you are happy about the post, you can then publish it.

Return user

  • Go to your blog post folder with live scripts
  • In MATLAB® Command Window, simply type wp_publisher:
    • The publishing tool will be opened and lead you to the Publish post tab, you will see a dropdown menu to choose the live script you want to post as article to your WordPress blog
    • You can check “Allow your readers to download your source Live Script” and your live script will be uploaded to your WordPress media library for users to download
  • Once you finish choosing your blog post, click Publish draft button, your live script will be posted to your WordPress as a draft.
    • The link to the draft of your post will be displayed in your MATLAB® Command Window (you need to log in your WordPress to see the draft)
  • You can preview the post, once you are happy about the post, you can then publish it.

Note

  • If you are not in your blog post folder, please close the publishing tool, go to your blog post folder with live scripts and reopen the App.
  • Once you click Publish draft button, the App will create a folder named as your live script to store the information of the article and images from your live script
  • You can update your WordPress settings in the App whenever your are using the App
  • In your live script of blog post, we suggest you add your article title so the publishing tool will know what’s your blog post title. If you did not add title in your live script, the publishing tool will add a placeholder title for your blog post, you can modify it later in your blog draft.
  • Once the live script is published to your WordPress site by the App and you want to make some editing on the article, instead updating directly in your WordPress, we’d suggest you edit your article in your MATLAB® live scripts and use the App again to keep content consistent. The App will know the post information from the output folder:

License

Distributed under the XSLA and BSD-3-Clause License

Community Support

MATLAB Central
Copyright 2021 The MathWorks, Inc.