XF 1.2 Wordpress Header for Xenforo

dash

Active member
Hi,

I am currently running a Wordpress site with a Xenforo forum. Is there any step by step guide to include the Wordpress header for the Xenforo site? I don't care about the sidebar or footer, I just want the same header for the site. There are a number of vague posts on this topic but I couldn't find anything close to a step by step guide.

I know there are Wordpress-Xenforo bridges available but I have no need to integrate users or any other aspects between Wordpress and Xenforo. I just want the same header for both. I was previously running PHPBB and there was an excellent video tutorial called "Skinning PHPBB". If anything similar exists, I would greatly appreciate it.

Thank You
 
Hi,

I am currently running a Wordpress site with a Xenforo forum. Is there any step by step guide to include the Wordpress header for the Xenforo site? I don't care about the sidebar or footer, I just want the same header for the site. There are a number of vague posts on this topic but I couldn't find anything close to a step by step guide.

I know there are Wordpress-Xenforo bridges available but I have no need to integrate users or any other aspects between Wordpress and Xenforo. I just want the same header for both. I was previously running PHPBB and there was an excellent video tutorial called "Skinning PHPBB". If anything similar exists, I would greatly appreciate it.

Thank You

Not really a direct tutorial for that, but I suppose there's a couple of ways of doing it. Do you have a link to your site?
 
I am also working on the same issue.

Its easy for me to create an iframe that uses the WP-header and stick that in the Xenforo header but that causes adsense ads a to not load correctly and not be targeted to the correct pages within xen. (my header contains ads.) I do that for sidebar widgets inside of xenforo (and previously vb) all the time. iframe. simple.

So I read about callback and have it working almost other then the wp-php generates errors now.

"Fatal error: Call to a member function get_queried_object() on a non-object in /home/x/public_html/test-home/wp-includes/nav-menu-template.php on line 395"

----

Alternative is to hardcode html the header and drop it into the xenforo header template. Downside is that changes have to be applied on wp and xen. I'd like one single header and footer for the entire site.
 
Alternative is to hardcode html the header and drop it into the xenforo header template. Downside is that changes have to be applied on wp and xen. I'd like one single header and footer for the entire site.

This is what I am interested in doing. My menus don't change frequently so that isn't a big deal. Unfortunately I don't know what to copy from the Wordpress header and where to include in the Xenforo header template.
 
@dash @Dodge you can do this easily. Just take a screenshot of your home wordpress page, and crop the title that you want.... Insert it in your xenforo header. And just make the width of your forum the same as your wordpress width. Then make the logo height the same as your wordpress height. Bam done. THis is how i did mine.
 
Basically the black parts. I am not very artistic lol
View attachment 61675

Like this?

1iAEVPu.png
 
Back to inserting WordPress PHP into the xenforo header. This is where I am at and I need help.

1. in the template header I inserted:

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

2. I created index.php and placed it in /library/XenForo/Header/index.php
Code:
<?php                  
                       
class XenForo_Header_index                                
{                      
    public static function getHtml()                      
        {              
                include './../1/iframe-header.php';        
                return $output;                            
        }              
        }              
                       
?>

3. I created on my site the following file. It contains most of Wordpress header info from the WP template. It executes on its own outside of Wordpress. But my Xenforo shows part of it. Then an error and no forum at all. /1/iframe-header.php

Code:
<?php
include( './../path-to-wp/wp-load.php' );
flush();                                
?>  
   
   
<style>                                
   
   
</style>                                
   
   
<?php wp_head(); ?>                    
   
        <script>                        
        (function() {                  
                var useSSL = 'https:' == document.location.protocol;        
                var src = (useSSL ? 'https:' : 'http:') +                  
                '//www.googletagservices.com/tag/js/gpt.js';                
                document.write('<scr' + 'ipt src="' + src + '"></scr' + 'ipt>');                                
        })();                          
        </script>                      
        <script>                        
                googletag.defineSlot('/123/728x90-Home',  [728, 90],  'div-gpt-ad-123-1').addService(googletag.pubads());            
                googletag.defineSlot('/123/300x250-Home', [300, 250], 'div-gpt-ad-123-2').addService(googletag.pubads());            
                googletag.defineSlot('/123/300x250-Home', [300, 600], 'div-gpt-ad-123-3').addService(googletag.pubads());            
                googletag.pubads().enableSyncRendering();                  
                googletag.enableServices();                                
        </script>                      
   
        </head>                        
   
   
   
<div id="sponsors">                    
        <img src="<?php echo get_bloginfo('url'); ?>/wp-content/themes/theme-name/images/sponsor-banner.png" alt="Banner: Sponsors" usemap="#sponsors" />                              
</div>
   
<map name="sponsors" id="sponsors">    
<area shape="rect" coords="155,0,266,64" href="http://www.sponsor1.com" target="_blank"  />          
<area shape="rect" coords="338,0,427,64" href="http://www.sponsor2.com" target="_blank"   />                    
<area shape="rect" coords="532,0,621,64" href="http://www.sponsor3.com/" target="_blank"  />                
<area shape="rect" coords="703,0,778,64" href="http://www.sponsor4.com" target="_blank"  />                    
</map>          

<?php responsive_container(); // before container hook ?>                  
<div id="container" class="hfeed">      
   
<?php responsive_header(); // before header hook ?>                        
   
        <div id="header">              
   
                <?php responsive_header_top(); // before header content hook ?>                                
   
                <?php if( has_nav_menu( 'top-menu', 'responsive' ) ) { ?>  
                        <?php wp_nav_menu( array(                          
                               'container'      => '',                      
                               'fallback_cb'    => false,                  
                               'menu_class'     => 'top-menu',              
                               'theme_location' => 'top-menu'              
                       )                
                        );              
                        ?>              
                <?php } ?>              
   
                <?php responsive_in_header(); // header hook ?>            
   
                <div id="logo" class="grid col-220">                        
                        <a href="<?php echo home_url( '/' ) ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/logo.png" alt="Logo: name of logo" id="image-logo" /></a>                          
                </div><!-- end of #logo -->                                
   
                <div id="header-ad" class="grid col-700 fit">              
            <div id="div-gpt-ad-123-1" style="width:728px; height:90px;">                            
                                <script>
    googletag.display('div-gpt-ad-123-1');                        
                                </script>
                        </div>                    
                </div>                  
   
   
   
   
                <?php wp_nav_menu( array(
                       'container'       => 'div',                          
                       'container_class' => 'main-nav',                    
                       'fallback_cb'     => 'responsive_fallback_menu',    
                       'theme_location'  => 'header-menu'                  
               )                        
                );                      
                ?>                      
   
                <?php if( has_nav_menu( 'sub-header-menu', 'responsive' ) ) { ?>                                
                        <?php wp_nav_menu( array(                          
                               'container'      => '',                      
                               'menu_class'     => 'sub-header-menu',      
                               'theme_location' => 'sub-header-menu'        
                       )                
                        );              
                        ?>              
                <?php } ?>              
   
                <?php responsive_header_bottom(); // after header content hook ?>                              
   
   
        </div>

----

The error I am getting is:

Fatal error: Call to a member function get_queried_object() on a non-object in /home/x/public_html/path-to-wp/wp-includes/nav-menu-template.php on line 395

I get this right below my 728x90 DFP banner. Missing WP navigation bar and no Xenforo.
If I comment out the nav menu template section in my iframe-header.php I get simply half of my WP header but still no forum.

Searching the support forum for a long time I feel that finding a good solution on how to insert php based headers from wordpress into xenforo is a topic many users are looking for. I am very close, but need a bit of help since I am just a php amateur.
 
You can also restyle the xenforo header to match the wordpress one using html/css. I do this for $30.
That's what I currently do with some other forum software. Transitioning over to Xen I'like only one single place on my site to make header changes and all other apps to just grab it.
Iframe is one simple solution but it hurts DFP/adsense as the frame would call banners in reference to the iframe 'page' not the actual page.

I have a working WP banner that i ported into a php and it works on its own flawlessly but not through callback.

Don't want to 'hardcode' theme it. Thanks for the offer.
 
Back
Top Bottom