1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Xenforo inside a Wordpress page.

Discussion in 'Styling and Customization Questions' started by OldCoals, Aug 29, 2012.

  1. OldCoals

    OldCoals Active Member

    How easy is it, or is it even possible to insert Xenforo into a Wordpress site?

    I don't need it to share data, I just want the Wordpress header and footer so to speak to "wrap" the forum.
  2. Digital Doctor

    Digital Doctor Well-Known Member

    To achieve that look you'd need to wrap Xenforo in a Wordpress iframe.
  3. Chris D

    Chris D XenForo Developer Staff Member

    Hmm, not necessarily and not really recommended.

    The most integrated way of doing it would be to update the XenForo header and footer templates and CSS to match the same HTML and CSS as used in the Wordpress theme. Or, indeed, update the WordPress theme to look like XenForo.

    Here's a site that does it very seamlessly:


    Front page is WordPress. The "Community" section is XenForo.

    No iframe in sight :)
    JamesBrown and Digital Doctor like this.
  4. Digital Doctor

    Digital Doctor Well-Known Member

    iframe is the easiest way.
    chris has outlined a better way (much harder to do).
    XenDynamic helps you style wordpress to look like Xenforo.
    Chris D likes this.
  5. OldCoals

    OldCoals Active Member

    That is exactly what I am looking to do.
  6. Chris D

    Chris D XenForo Developer Staff Member

    If you contact The Big K on here, he may give you some advice. He's a jolly nice fellow :D
    TheBigK likes this.
  7. Paul Thomson

    Paul Thomson New Member

    Hey Chris,

    Sorry to post on a dated thread but had a question regarding wordpress/XF integration and figured answers could possibly help others who end up here...

    The trouble I see with wrapping your wordpress HTML output around the forum is that each time you make a change to say a main menu item you'll have to go back and dig through the HTML and make that change in XF templates, if you remember to do so that is! Not a huge problem for small sites but with larger sites could cause a big issue.

    Currently I've got my forums running via an iframe (temporarily so I can edit the styles to match the main site template), you can see it live here: http://www.livefreedietravelling.com/forums/ I've also got a Wordpress template set up which I've copied here: http://pastebin.com/nuvCc9SY

    I've read a couple of related forum posts on (ie here) but which do not solve the above problem.

    So my question, is there a way to execute PHP direct from the PAGE_CONTAINER template, and if so, would it not be possible to run some PHP code like this to correctly execute Wordpress whilst also executing XF:

    include ("http://www.website.com/wp-load.php");
    (call to Wordpress header)
    (CSS overrides file)
    (a wordpress theme template including the modified XF PAGE_CONTAINER code)
    (call to Wordpress footer)
    * Bootstrap file for setting the ABSPATH constant
    * and loading the wp-config.php file. The wp-config.php
    * file will then load the wp-settings.php file, which
    * will then set up the WordPress environment.


    I'm completely new to XF and really not sure how to go about implementing the above setup (if even at all possible), any help would be greatly appreciated and sure it would help others do the same.

  8. LPH

    LPH Well-Known Member

    You may have a better user experience simply taking an easier approach to maintenance. Take your header code from your WP child theme and copy it into the header template in XF. You'll need to modify some paths and CSS.

    After several attempts, I finally just stripped out the XF navigation and moved a portion to the top (created a new template) then added in the WP menu into navigation template. You'll have to work through some CSS issues.

    Finally get a unified login by using XenScripts instead of trying to get the user to login twice.

    Since your site is only one domain then getting WP and XF to look the same is best done as Chris suggested above (copy WP child header to XF). Some of us are just working through getting alerts on the WP side - otherwise - all is good.
  9. Paul Thomson

    Paul Thomson New Member

    Hey lph,

    thanks for the reply! So just to clarify, it is possible to include PHP code and wordpress calls from within the header template of XF?

  10. TheBigK

    TheBigK Well-Known Member

    We only match the styles and there's actually 'zero' integration. I'm ready to donate about $300 ( PM me if you're interested) to anyone who can bring the the XF goodies (alerts, user profile, login etc.) to WordPress so that we have the best of the CMS and the best of the Forum software working in harmony.

    Would really love to see a powerful bridge / integration being developed.
    Deepmartini likes this.
  11. Paul Thomson

    Paul Thomson New Member

    Thanks for the reply TheBigK, that's a shame to hear there is currently no integration for wordpress as I think it would be a great addition (and huge selling point) for XF. I've seen a couple of WP bridges currently out there but non that will easily allow me to plug the forums into a standard WP template page, I think for someone with the skills this would probably be an easy thing to do, though I could be wrong as I'm very new to XF.

    I would be also be able to contribute a small amount to see the above feature be developed.

  12. TheBigK

    TheBigK Well-Known Member

    Let's start a fund then? :)
  13. Paul Thomson

    Paul Thomson New Member

    Ok, how would that work?
  14. craigiri

    craigiri Well-Known Member

  15. Chris D

    Chris D XenForo Developer Staff Member

    There's also the XenForo REST API which is on the front page of the Resource Manager.

    In theory that provides an endpoint for you to fetch things like alerts and other XenForo information.

    It would still take a lot of work to get fully integrated but it might go a long way to getting it sorted.
  16. Brandon Sheley

    Brandon Sheley Well-Known Member

    iframe should NEVER be the answer to any question on this forum or any website really. ;)
    creativeforge likes this.
  17. TheBigK

    TheBigK Well-Known Member

    Do it, Chris! You're awesome! :rolleyes:
  18. LPH

    LPH Well-Known Member

    I see TheBigK already answered but just wanted to say that I actually use XF code on the WP side because of XenScripts. Also, you can do some basic PHP callbacks in an XF template.

    The alerts might be handled by XenScripts. Sorry, I only tinkered with it for a little bit and moved on to other projects, however, the idea by Chris would work.
  19. shawn

    shawn Well-Known Member

    I'd be interested in a more general discussion of how and what gets integrated, if that's where this is heading. We have used WP for the landing page since we were on VB, but never had any integration to speak of. The WP had its own user table, commenting was disabled, etc.

    I've been experimenting with using an XF skin for WP and bridging the XF users over, but... WP code sucks. I can only take so much concatenation and embedded php before I stab myself in the thigh. I think we can get what we need here, but I'm going to have to write a lot of my own theme files first.

    I also looked at xenporta... it's nice, and *almost* enough of a CMS to do what I need. If it had a global media manager (with captions and left/right/center justification) and included a story/comments type template for the threadview (and it might, I haven't really had the chance to look), it would be really, really close. I could just import over all our existing articles as new threads. And I really love the idea that front-page items could then appear in the Recent Activity log and the New Posts list. That's something I'm not sure we could get easily from a WP-based system.

    Also, we modified wordpress to allow for a second news item to appear as a sidebar in a story. I'd really like for a XF-based CMS/portal to include something like this... maybe could use something like Waindigo's extra fields add-on. Should be fairly straightforward.

    If any of this aligns with the overall project goals, I can definitely match TheBigK's $300 seed money.
  20. LPH

    LPH Well-Known Member

    Just to help out with a little bit more information. Sorry, it's getting late so I'll just post the WordPress child theme header. You can see that I use XF information.

    <fieldset id="header_bar">
        <div class="pageWidth">
            <div class="pageContent">
                    if ( is_user_logged_in() ) {
                        global $current_user, $XF;
                        echo '
                            <span id="member" class="loggedIn_menu_class"><a href="/community/conversations/">Inbox</a>
                            <a href="/community/logout">Log Out</a></span>
                        echo '
                            <span id="member" class="loggedIn_menu_class">
                            <a href="/community/members/'. strtolower($XF->visitor->get('username')) . '.' . $XF->visitor->get('user_id') .'">'.$current_user->display_name.'</a></span>
                            if ( $site_admins = array ( 'insert in the names of admin' ) ){
                                echo '
                                    <span id="member" class="admin"><a href="/wp-admin">WordPress Admin Panel</a>
                                    <a href="/wp-admin/post-new.php">WordPress Add New Blog Post</a>
                                    <a href="/community/admin.php">XenForo Admin Panel</a></span>
                    } else {
                        echo '
                            <script>XenForo.LoginBar = function(a){};</script>
                            if ($_SERVER['HTTP_HOST'] == 'tuxnotes.tuxreportsnetwork.com') {
                                echo '<span id="member" class="logIn_menu_class"><a href="http://www.tuxreportsnetwork.com/community/login" class="OverlayTrigger inner">Log In or Sign Up</a></span>';
                            } else {
                            echo '<span id="member" class="logIn_menu_class"><a href="/community/login" class="OverlayTrigger inner">Log In or Sign Up</a></span>
                    } }                ?>
    Well - you get the idea. I never finished the XenForo.LoginBar = portion .... I was waiting for SSO to be done.
    ThEDoZEr and Paul Thomson like this.

Share This Page