Laravel包括安装在公共目录中的wordpress的项目导航栏

we have a /resources/views/inc/navbar.blade.php that is used in our Laravel application main layout.

We installed a Wordpress app in the /public directory.

We need to be able to use the same navbar in our ourdomain.com/blog

Any ideas in how to this can be accomplished?

Just a brainstorming:

  1. You can show your blog in your laravel application (maybe html frames?).
  2. You can show your navbar in your blog application (get navbar via api and render it on your wordpress template)

Ok. I think this same solution could be resolved with a regular web.php route as well

  1. routes api.php

    Route::get('/wp-menu',function() { return view('/wp-includes/wp-menu'); });

  2. new view in /views/wp-includes/wp-menu.blade.php (I'm excluding the css and js)

    @include('/inc.navbar')

  3. Wordpress after the open body tag

on the footer before the closing body tag or you can find any of the jQuery js files

$(function() {
    $('#navBarContainer').load('yourdomanin.com/api/wp-navbar');
});

And that worked, we now have the same navbar working inside our Laravel project and our wordpress, one thing to note is that is will only work in the same domain