• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

WP topmenu at Xenforo site

Gracie

Dogs Times Writer
The XenForo header template is modified by adding a callback to a PHP file.

Code:
<xen:callback class="TRN_XenWord_Model_WPNavigationTop" method="getHtml"></xen:callback>

This is the complete header file:

Code:
<xen:edithint template="header.css" />

<xen:hook name="header">
<div id="header">
    <div class="pageWidth">
        <div class="pageContent">

            <xen:callback class="TRN_XenWord_Model_WPNavigationTop" method="getHtml"></xen:callback>
            <span class="td-logo-text-container">
            <h1 class="td-logo">
                    <span class="td-logo-text">TUX REPORTS</span>
            </h1>
            <span class="td-tagline-text">A Penguin's View of the World</span>
            <span class="helper"></span>
            </span>
           
            <xen:include template="navigation" />
        </div>
    </div>   
</div>
</xen:hook>

The WPNavigationTop.php file has the following code:

PHP:
<?php
/**
* Filename: WPNavigationTop.php
*/

class TRN_XenWord_Model_WPNavigationTop extends XenForo_Model {

   public static function getHtml() {

      define( 'WP_USE_THEMES', false );
      define( 'DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT'] );

      require( DOCUMENT_ROOT . '/wp-load.php' );

      echo '<div class="wordpress-time">';

         // the_time('l, F jS, Y');
         echo date_i18n( 'l, F jS, Y', strtotime( '11/15-1976' ) );

      echo '</div>';

      $args = array( 'menu' => '2797' );

      wp_nav_menu( $args );

      echo '<div class="wordpress-line"></div>';

   }
}
// End WPHeader.php

Finally, the extra.CSS has the needed CSS to give the same look as the WordPress side. There is still plenty of work to do to match the WP and XF sides of the site but this was the start.
 

Gracie

Dogs Times Writer
The WordPress primary menu is not included in XenForo at this time because the MegaMenu code from the WordPress theme does not load properly.
 
Top