Hey, I’m using the wordpress-plugin to display a Hype-animation graphs from example am-chart chart library.
To streamline the workflow I want to create one main hype-presentation, with different graphs in different scenes (for a number of reasons) and then call different scenes on different posts and pages in wordpress.
How do I open the open the animation on a specific scene with the wordpress-plugin? Is there a a way to put in I the shortcode?
Like this: [hypeanimations_anim id=“4”, scene=“7”]
@MaxZieb recently created this extension to enable communication between embeded hypedocuments and from external html. it's is described to work with iframe-embedding too ....
In you Hype load in the first Scene (best you leave it empty or with a loader splash) the following function:
/* fetch container by documentId & fetch parentNode class */
var doc = hypeDocument.getElementById(hypeDocument.documentId());
var divClass = doc.parentNode.className;
/* check the result in console (remove in production) */
console.log("ParentNode is: " + doc.parentNode);
console.log("ParentNode className is: " + divClass);
/* do something with the class ... like switching scene */
hypeDocument.showSceneNamed(divClass);
Just realized the last solution isn’t flexible as the class is only set once. And used on each embed. But then maybe you can use window.location.pathname if each embed has it’s own page …
var scene = "";
/* do something with the class ... like switching scene */
switch (window.location.pathname) {
case "/path1":
scene="Scene_1"; break;
case "/path2":
scene="Scene_2"; break;
case "/path2":
scene="Scene_3"; break;
}
hypeDocument.showSceneNamed(scene);
Okay I got the solution (put this in a init-function in your first scene):
//fetch container by documentId & fetch grand parentNode dataset
var doc = hypeDocument.getElementById(hypeDocument.documentId());
var dataset = doc.parentNode.parentNode.dataset;
//check the result in console (remove in production)
console.log("GrandParentNode is:");
console.log(doc.parentNode.parentNode);
console.log("GrandParentNode dataSet is:");
console.log(dataset);
// do something with the dataset ... like switching scene
hypeDocument.showSceneNamed(dataset.scene);
In WordPress use the “TEXT” mode in the classic-editor and wrap the shortcode
Here is a shortcode you can use if you have access to your functions.php. This is something you should only use in a childtheme so you can still update your main theme.