Showcasing Your H5Ps With Wordpress #
Sometimes we want to demo new content types. otacke suggested that Wordpress is a good way to do it and it’s working so far.
Set up your Wordpress Site #
I set up a Digital Ocean Droplet using the Wordpress Droplet, I’m using the Portfolio Theme by Theme Horse.
- Install H5P as a plugin
- Adjust the wp.config:
/* wp-config.php, the very bottom
/* Add any custom values between this line and the "stop editing" line. */
define('H5P_DEV', true);
This will ensure that the H5P plugin will use this as the latest version without you having to increment the patch number.
- Restart Wordpress:
sudo systemctl restart apache2
Read more at the official docs.
Export Your Content #
Let’s say you’re developing h5p-true-false
, to show off your latest changes.
-
Create content using the
h5p-cli
that can showcase your work, call itTest-true-false
-
Use the
h5p export
function to export a content type. Here’s what it does:h5p export <library> <folder>
will export the<library>
content type from thecontent/<folder>
So, let’s say we’ve adjusted
h5p-true-false
, let’s try to export it:~repos/h5p $ h5p export h5p-true-false Test-true-false
This means
h5p export
tries to find some content calledTest-true-false
that is using the libraryh5p-true-false
and then zips it up and gives it a.h5p
extensionThis is where the H5P will be saved:
temp/Test-true-false.h5p
Upload Your Content #
- Move your content to an easier location:
mv ~/repos/h5p/temp/Test-true-false.h5p ~/Desktop
- Go to
<yourwordpresssite>.com/wp-admin
and press “Add New” in the left side bar under “H5P Content”, then “Upload”. - Select your
Test-true-false.h5p
file from your Desktop - Press “Create” on the right hand side
- Copy the short code, in my case it’s
[h5p id="4"]
- Past the shortcode into a Wordpress post and check it that it works!