Integrating WordPress and PunBB

You might have noticed the new Forum link on the top of this site. I’ve just finished integrating the lovely PunBB with the amazing WordPress, featuring the brand new k2 theme. Visually integrating the two programs is a very easy process, made even easier by the tutelage of LiewCF, who posted a nice guide on his blog.

I’ll walk you through the process of integrating PunBB with WordPress/k2 here at æ.

1. Install PunBB and add a link to your forum (or whatever you call it) to your WordPress theme header. In my case, this meant adding the a link to the forum like this:

<li class="page_item"><a href="http://eldorado.heroku.com">Forum</a></li>

within the

<ul class="menu"></ul>

section near the end of the k2 header code. You can download my k2 header file, if you’d like to have a look at it.

2. The only other thing you need to edit is the main.tpl file included with PunBB. If you’re using the default k2 theme, you can download my main.tpl file, and simply replace yours with that one. The file is located in

/include/template/

within the PunBB folder. This should cover you using the Oxygen PunBB style, but some other styles might not look right. You can edit these via the Profile -> Display options when you’re logged into PunBB.

Customized k2 Theme. If you are using a customized version of the k2 theme, take a look at the code added in-between the

<!-- WordPress Template CSS -->

code comments in the main.tpl file. You might want to change the colors added in the CSS

<style type="text/css"></style>

area to match your own. This should allow you to override the PunBB colors enough to make it match your theme. If you’re using a different custom k2 stylesheet, you’ll want to include that at the top of your main.tpl file instead of the sample.css CSS.

Other Themes. If you made a lot of changed to k2, or you aren’t using k2 at all, you’ll need to collect the CSS, header, and footer code from your blog manually. Do a View Source on your blog, and copy the code for your CSS stylesheets, header, and footer into your PunBB main.tpl file. You might want to begin by downloading the main.tpl file I linked to above, and note the code comment areas, which indicate exactly where to paste in your WordPress code:

<!-- WordPress Template CSS -->
<!-- WordPress Template Header -->
<!-- WordPress Template Footer -->

You’ll have to do some fiddling, but the basic idea is to get the code from your WordPress blog into those 3 sections of the main.tpl file. The goal is to wrap your PunBB forum within your WordPress header and footer, while including the CSS for the overall look and feel. Another small thing is to give the list-item that contains the link to your forum a class of current-page-item as I’ve done in my main.tpl file. This will highlight the forum link in the header when you’re in the forum.

Update: I made a couple of small changed to get things working properly in (boo!) Internet Explorer. My main.tpl file contains the fixes. I added this line to the CSS:

.pun { font-size: 11px !important; }

and also changed this line

#punwrap { padding: 0; padding-top: 10px; margin: 0; width: 760px; }

to sets the font size and width specifically. So, if you’re using the flexible width or a different font size in k2, you might need to make some tweaks.

Update 2: I’ve updated my main.tpl file again to match the new look on this site. If you’re interested, please feel free to take a look. Be careful, though – this file is straight from my site, so it still contains code to include Mint, links to my CSS, header navigation bar, footer, etc etc etc. If you’re going to use this file on your site, you’ll most certainly have to edit it first.

Update 3: Another redesign, another new main.tpl.

That’s it! Discuss… in the forum »

Update 4: By the way, I ended up leaving PunBB and writing this instead:

http://almosteffortless.com/eldorado/

20 Responses to “Integrating WordPress and PunBB”


  1. 1 Danno July 22, 2006 at 12:37 am

    When its integrated like this does it share the database of users or do people have to sign up for the site (ie when they leave comments) and then for the forums too? Thanks

  2. 2 Trevor July 22, 2006 at 4:12 am

    Danno, this is just a visual integration. As far as I know, there aren't any deeper integrations with a unified login etc, but there seems to be a lot of demand for something like that. You can check this out, which is something in the right direction. http://forums.punbb.org/viewtopic.php?id=8373

  3. 3 Joe October 19, 2006 at 11:46 am

    Hey man, I am going to use this tutorial on my site, if that's okay with you (will give you credit and a link of course) once I get my new site up and running. I am currently trying to adjust some settings. The site looks perfect in IE (once the forum nav is hovered over), but looks horrible in FF. Any suggestions? And if you have any suggestions about that hoover issue, that would be great too. Thanks man…heres the url: http://www.webreality.net/wp/Punbb/upload/

  4. 4 Trevor October 19, 2006 at 12:02 pm

    Joe, you can feel free to re-publish this article, as long as you give me credit and link back to this page. As for your display problems, you can ask in my forum, but I don't have time to troubleshoot it with you myself right now.

  5. 5 Prizeking October 21, 2006 at 7:06 pm

    Great article and It's working very well on my blog!
    thanks

  6. 7 Earline Olesnevich March 18, 2010 at 3:03 pm

    Satisfactory blog, some interesting information. I remember 9 of days ago, I have found a similar post. Does anyone know how to track future posts?

  7. 8 Oscar Chartraw May 24, 2011 at 11:20 pm

    i perceive that is not precisely on topic, but i have a weblog using the blogengine operating system as well and i’m getting issues with my comments displaying. is there a establishing i am forgetting? possibly you might assist me out? give thanks to you.


  1. 1 Yep… you read right! at MacMove Trackback on September 26, 2005 at 7:04 pm
  2. 2 PunBB on Wordpress (with K2) at Wordpr.ectio.us Trackback on September 28, 2005 at 10:44 pm
  3. 3 Blogalistic - Integrating Wordpress and PunBB Trackback on October 23, 2005 at 7:46 am
  4. 4 PixelToast Trackback on June 19, 2006 at 8:35 am
  5. 5 Integrating a Forum with WordPress | blogHelper Trackback on September 18, 2006 at 11:31 am
  6. 6 skriban.com » Blog Archive » Forum Integration in Wordpress Trackback on January 28, 2007 at 1:52 pm
  7. 7 Forum sous Iexplorer 6.0 at I N T R A N E T Trackback on May 10, 2007 at 5:30 am
  8. 8 Wordpress und Forum Plugin » Netprofit Trackback on August 9, 2007 at 5:21 pm
  9. 9 Integrating a Forum with WordPress | 4uwebcash.com Trackback on February 2, 2008 at 7:42 am
  10. 10 :Wordpress’e Forum Ekleme-TurkForum.Net Trackback on June 21, 2008 at 6:07 am
  11. 11 Integrating PunBB into Wordpress | Network Aesthetics Trackback on November 10, 2008 at 1:37 pm
  12. 12 Wordpress und Forum Plugin Trackback on January 27, 2010 at 12:58 pm
Comments are currently closed.




Follow

Get every new post delivered to your Inbox.