I have a Wordpress site using a generic theme. I made React app I would like to use as a frontpage of my site. Already collected data using REST API. How can I integrate my bundle.js into existing Wordpress page?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I think you can use shortcode like this [my_shortcode] in some wordpress page.
Then you need to implement it in your plugin (or new plugin if you have no plugins).
just add the following
add_shortcode( 'my_shortcode', 'my_shortcode_handler' );
In your my_shortcode_handler you can serve the html,js,css of your React App By using some WP functions like:
wp_enqueue_style
wp_enqueue_script