1

So I have been working on a site using the theme Vantage and I am wanting to take the menu from the site and embed in another site in a subdirectory below, I have searched all over the internet trying to find someone who maybe have tried to do something like that but am unsuccessful so I am coming here. Could anyone please tell me how I might be able to do this?

Thanks in advance!

  • I can only see this being done via iframe or maybe trying to access the wp API with something like wp-api.org – gdaniel Dec 23 '14 at 16:05
  • @gdaniel Well could you maybe show me how I could do that? – Arctoran Dec 23 '14 at 16:14
0

There's a couple ways to do this. One way might be to create a file on your web server, load up WP (so you can use its functions) and have it spit out the menu you want at a certain URL, like:

http://site/nav.php

In that file you'd do something like:

<?php 
      include( './wp-load.php' ); // load up WordPress
      wp_nav_menu( array ( 'menu' => 'whatever' ); // spit out a menu called 'menu'
?> 

Then on the other site, you'll want to get the output of that file like:

<?php echo file_get_contents('http://site/nav.php') ?>

That'll spit out the menu where you need it on the second site.

To get it to look right, you'd also have to bring some markup and styles from the other site but that's the gist of it.

Related: wp_nav_menu(); Outside WordPress installation

  • Sure, I've been there. Sometimes you just need a push in the right direction! – RitterKnight Dec 23 '14 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.