[wp-hackers] Access the wordpress menu from another CMS in a subdirectory
Dwain Maralack
dwain.maralack at gmail.com
Thu Jul 12 22:45:38 UTC 2012
Hi all
Thanks for the reply Ryan.
My challenge was to integrate Wordpress , BuddyPress and Family CMS .
The solution to having the same menu on all platforms was a plugin
called JSON-API. The plugin exposes Wordpress functions via an API.
I had to write a special function inside this plugin that would send
the current primary menu via the API.
Regards
Dwain Maralack
0731576641
On 07 Jul 2012, at 5:20 AM, Ryan McCue <lists at rotorised.com> wrote:
> Dwain Maralack wrote:
>> <?php
>> // no theme output
>> define('WP_USE_THEMES', false);
>>
>> $_SERVER = array(
>> "HTTP_HOST" => "http://localhost:8888/akfam/",
>> "SERVER_NAME" => "http://localhost:8888/akfam/",
>> "REQUEST_URI" => "/",
>> "REQUEST_METHOD" => "GET"
>> );
>
> You shouldn't need to do any of this unless you have badly behaving plugins.
>
>> // initializes Wordpress
>> require_once('/Users/miiweb1/Sites/akfam/wp-blog-header.php');
>
> Use wp-load.php here instead of wp-blog-header.php
>
> ----
>
> Here's what I use:
>
> <?php
> class MyClass {
> // ...
> public static function load_wp() {
> if (empty(self::$wp_path)) {
> throw new Exception('WordPress could not be loaded', 500);
> }
>
> global $wp_the_query, $wp_query, $wp_rewrite, $wp;
>
> define('DISABLE_WP_CRON', true);
> require_once(self::$wp_path . '/wp-load.php');
> }
>
> The globals are required if loading through a function. There may be others as well depending on what plugins you have. (WP should really have that built in, rather than assuming it's in the global context.)
>
> DISABLE_WP_CRON is for performance reasons; I don't want cron running on the site this lives on.
> --
> Ryan McCue
> <http://ryanmccue.info/>
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list