swashata / wp-webpack-script

💥🔥📦👩‍💻 An easy to use, pre configured, hackable webpack setup & development server for WordPress themes and plugins.
https://wpack.io
MIT License
407 stars 57 forks source link

Shortcode params #1248

Open douglasscriptore opened 2 years ago

douglasscriptore commented 2 years ago

How do I get attributes from the shortcode within React?

Example: [my-shot-code view="main"]

Rados51 commented 2 years ago

@douglasscriptore Shortcodes are rendered via PHP as regular DOM elements inside WP. You will have to assign those attributes to DOM element, and then you can get them with document.querySelector.