Last active
October 11, 2020 07:30
-
-
Save ravewebdev/496e6e19e67606e5558e09a2d80058b3 to your computer and use it in GitHub Desktop.
2.2. Static Block Replacement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const trackerClass = '.wp-block-rave-initiative-tracker', | |
trackers = document.querySelectorAll( trackerClass ); | |
trackers.forEach( ( tracker ) => { | |
const attributes = { | |
block_id: tracker.dataset.id, | |
post_id: parseInt( tracker.dataset.post_id, 10 ), | |
}; | |
render( | |
<FrontendTracker dataAttributes={ attributes } />, | |
tracker | |
); | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment