Dogstudio / highway

Highway - A Modern Javascript Transitions Manager
https://highway.js.org/
MIT License
1.43k stars 92 forks source link

Change body class on page change (WordPress) #42

Closed imbeard closed 5 years ago

imbeard commented 5 years ago

Hi, first of all the library looks amazing! I'm facing some issues updating body classes (standard WP behavior) after a page transition end.

Any hints for pointing me in the right direction?

thanks!

ThaoD5 commented 5 years ago

Hello @imbeard, on our last production, we proceeded this way :

window.H.on('NAVIGATE_IN', (to) => {
  document.body.classList = to.page.body.classList
});

Have a good day

imbeard commented 5 years ago

@ThaoD5 thanks a lot! will try it

Brendan1983 commented 5 years ago

@imbeard and @ThaoD5 - I've been trying to include Highway in my Wordpress projects for a little bit, but I can't seem to make any headway. Do you use a particular starter theme or framework?

I work off of _s theme and compile our SCSS/JS with Codekit, but Highway might finally push me into using a more modern Workpress theme workflow.

I just completed a React Udacity course, but would really love a lightweight alternative to the headless CMS route. I would be open to paying a consulting fee for your time if either of you would be open to showing me the ropes of how you build your WP themes with Highway. Just throwing it out there if anyone's interested!