• Hello,

    Apologies if this isn’t necessarily WordPress related.

    I am using the open source learning environment Moodle and I am creating a theme for it (using Moodle 2.1)

    I am trying to include the menus from my WordPress site into the theme so that they are automatically updated when they are changed in WP.

    Ordinarily it would be as simple as including the following code:

    <?php
    /* Short and sweet */
    define(‘WP_USE_THEMES’, false);
    require(‘./wp-blog-header.php’);
    ?>

    Allowing the menu to be called, like:

    <?php

    wp_nav_menu( array( ‘sort_column’ => ‘menu_order’, ‘menu_class’ => ‘nav’, ‘theme_location’ => ‘top-menu’ ) );

    ?>

    But for some reason this causes Moodle to crash completely, so I assume there must be some kind of conflict going on.

    I was wondering if there is any way to get by this conflict and allow WordPress elements to be called?

    If anyone can give me any pointers it would be very much appreciated.

    Best regards and a Happy New Year to all!

Viewing 1 replies (of 1 total)
  • Thread Starter mlmultimedia

    (@mlmultimedia)

    After a little more research I have found that it is the get_users() function that is conflicting because it is being called by both WP and Moodle… I don’t think there is a way to get round this…

    Fatal error: Cannot redeclare get_users() (previously declared in D:\wamp\www\tefl\course\lib\datalib.php:184) in D:\wamp\www\tefl\wp-includes\user.php on line 641

Viewing 1 replies (of 1 total)
  • The topic ‘Include WordPress Menus in Moodle Theme’ is closed to new replies.