It's easy to display (via php) the primary menu of the Drupal 6.20 site inside a WordPress theme template file situated inside a subdirectory on a single domain?
At this time, I am exhibiting recption menus by copying the static html in the Drupal site and adding it to header.php within the WordPress template within the site situated in mydomain.com/blog/. However that isn't likely to work when another food selection is put into the Drupal site, or even the Drupal menu is transformed by any means.
So it is possible to Drupal php function which will pull recption menus in to the Wordpress file?
Failing that, it is possible to way with php to parse a Drupal page for that html from the menu (yes, this is ugly) and display it in Wordpress?
Part one from the challenge would be to output just the menu, with very little (or none) from the surrounding HTML as you possibly can, so you've very little try to do in parsing the HTML as you possibly can.
The 2nd part would be to take that output from Drupal and really display it in your WordPress site.
You could include the Drupal database like a secondary database in WordPress while using a brand new demonstration of the $wpdb object, write the query to obtain the right content in the tables, and format the outcomes. That may work, but may be overkill.
An alternate workable option might be to make use of JSON to format the creation of the main links, while using drupal_json function in Drupal, then take in the JSON enter Wordpress.
I am presuming:
- you've admin use of login towards the Drupal site, which you will need to create nodes, and obvious the theme cache
- you need to output the main Links menu, which 90%+ of Drupal sites use. This really is most likely true, but it's possible your website uses custom menus. If that's the case, this really is still possible, you'd just write slightly different code in step three.
The steps could be:
- Produce a Drupal node (you are able to refer to it as anything, it is simply a placeholder)
- Obtain the node id of the dummy page (ie., node/234). In the node id, produce a one-off-page template inside your Drupal site's styles folder. It ought to be known as
page-node-xxxx.tpl.php, with xxxx being your node id
Add this code to
<?php drupal_json(menu_navigation_links(variable_get('menu_primary_links_source', 'primary-links'))); ?>
This can produce a JSON feed of the menu products.
You need to now have the ability to make use of a jQuery method like $.getJSON or $.ajax inside your Wordpress theme to eat and display the JSON feed, or even use json_decode and curl to output your array as HTML.
A positive thing about Drupal's
drupal_json function is it already transmits the right JSON headers, now all you want do is write the jQuery or PHP that does the thing you need.
I am assumed you're much more of a Wordpress specialist and also have a working understanding of Drupal but maybe very little knowledge of its inner workings. So, sorry whether it appeared too fundamental (or otherwise fundamental enough :).
The Drupal theming engine is extremely modular - you might have the ability to make a suitable PHP call into Drupal to obtain only the menu made, then emit that HTML as part of your WordPress page.