Streaming live at 10am (PST)

Webflow to Wordpress JS


I am trying to migrate my website to Wordpress and can’t seem to successfully use my interactions and functions on the Wordpress theme. I created a Wordpress theme from scratch and everything works perfectly. I enqueued my new scripts.js file that includes all of Webflow’s functions.js code and it seems to work as the file loads, but no interactions work.

Here’s the enqueued function:

add_action('wp_enqueue_scripts', 'tutsplus_enqueue_custom_js');
function tutsplus_enqueue_custom_js() {
wp_enqueue_script('custom', get_stylesheet_directory_uri().'/scripts/custom.js', 
array('jquery'), false, true);

Hope someone can help.

Here is my public share link: LINK
(how to access public share link)

I’m wondering the same thing.

Hi, Shmuel.

I sorted it out and the JS generated in Webflow works perfectly in Wordpress. The JS is linked to the data-wf-page attribute (page ID). I created a workaround by:

Creating a variable on each page template on Wordpress. The variable is the page ID coming from Webflow.
On the header.php file, I print that variable.

That way, every time the header is used, it will automatically get the correct Page ID, making the interactions work. I also put it on single.php and page.php templates to enable their use on new pages and ensuring they always work.

Hope it helps.

Thank you - including the page ID worked for me.