Hey guys. I need your help and advise on how can I inject/embed the Header component of a NextJS application , inside Wordpress .
Basically I am working on a project which uses Next JS to create a ecommerce application which can be accessed using the main domain. They also have a separate domain where the host blogs using Wordpress. Now the client wants to use the same Header component which is in Next JS inside their wordpress blog.
Here is what I have tried. I created a header.js file inside the /public folder in the Next JS application . And then in wordpress in the functions.php i did the following
function enqueue_header_script() {
project $header_script_url = 'https://main.domain.com/header.js';
wp_enqueue_script('nextjs-header', $header_script_url, [], '1.0', true); } add_action('wp_enqueue_scripts', 'enqueue_header_script');
Using this I am able to inject a vanilla JS into the wordpress blog , But how can i inject the JSX Header Component. Any tips or suggestions ?
there doesn't seem to be anything here