<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Justin Tadlock &#187; bbPress</title>
	<atom:link href="http://justintadlock.com/tags/bbpress/feed" rel="self" type="application/rss+xml" />
	<link>http://justintadlock.com</link>
	<description>Life, Blogging, and WordPress</description>
	<lastBuildDate>Fri, 11 May 2012 00:27:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>How to create custom views in bbPress</title>
		<link>http://justintadlock.com/archives/2009/07/15/how-to-create-custom-views-in-bbpress</link>
		<comments>http://justintadlock.com/archives/2009/07/15/how-to-create-custom-views-in-bbpress#comments</comments>
		<pubDate>Thu, 16 Jul 2009 03:16:42 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[bbPress]]></category>
		<category><![CDATA[bbPress Tutorials]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=1743</guid>
		<description><![CDATA[A tutorial on creating custom views for bbPress that covers creating the views, listing them, and making custom templates to handle their display.]]></description>
			<content:encoded><![CDATA[<p><span class="drop-cap">I</span>n bbPress, we have these things called <em>views</em>.  Views are used to show a certain, well, view of your topics, posts, users, and so on depending on the purpose of the view.  Several plugins offer alternative views (e.g., highest rated topics, most posts, etc.).</p>
<p>Fortunately, bbPress comes loaded with a function called <code>bb_register_view()</code> that makes this extremely simple.  I&#8217;ll be showing you how to create new views in this tutorial.</p>
<p>Some things worth noting:</p>
<ul>
<li>Views are displayed according to the <code>view.php</code> file within your theme.</li>
<li>bbPress comes loaded with with two default views: &#8220;Topics with no replies&#8221; and &#8220;Topics with no tags.&#8221;</li>
<li>The <a href="http://bbpress.org/plugins/topic/my-views" title="My Views bbPress plugin">My Views</a> plugin creates some neat views and is definitely worth checking out.</li>
</ul>
<p>Here&#8217;s a look at some custom views I&#8217;ve create:</p>
<div id="attachment_1744" class="wp-caption aligncenter" style="width: 610px"><img src="http://justintadlock.com/blog/wp-content/uploads/2009/07/custom-views.png" alt="Custom bbPress views" title="Screenshot of custom views in bbPress" width="600" height="327" class="size-full wp-image-1744" /><p class="wp-caption-text">Custom bbPress views</p></div>
<h2>The bb_register_view() function</h2>
<p><code>bb_register_view()</code> is the function that handles creating new views.  Let&#8217;s take a look at its parameters and what we can do with them.</p>
<pre><code>bb_register_view( $view, $title, $query_args = '', $feed = TRUE );</code></pre>
<p><code>$view</code> is what you&#8217;ll name the view.  What you put here will also become part of the permalink to the view page.</p>
<p><code>$title</code> is the title of the view that you&#8217;ll see on screen.  It&#8217;ll show in view lists and likely on your view page.  <em>Note:  Theme and plugin developers should localize this so it can be translated.</em></p>
<p><em>Optional:</em>  <code>$query_args</code> should be an array of arguments on how to display the topics and such on the view&#8217;s page.</p>
<p><em>Optional:</em>  <code>$feed</code> is whether the view should have its own feed.  This is set to <code>true</code> by default.</p>
<h2>Creating a custom view</h2>
<p>Now that you know how the <code>bb_register_view()</code> function works, it&#8217;s time to create a couple of views.  The first thing you should do is open your theme&#8217;s <code>functions.php</code>.  If your theme doesn&#8217;t have this file, create one.</p>
<p>We&#8217;ll create two new views: Alphabetical (ascending) and Alphabetical (descending).  Drop this code in your <code>functions.php</code> file:</p>
<pre><code>&lt;?php

add_action( 'bb_init', 'my_custom_views_init' );

function my_custom_views_init() {
	$args = array( 'order_by' => 'topic_title', 'order' => 'ASC' );
	bb_register_view( 'alphabetical-ascending', __('Alphabetical: Ascending (A &ndash; Z)', 'example'), $args, false );

	$args = array( 'order_by' => 'topic_title', 'order' => 'DESC' );
	bb_register_view( 'alphabetical-descending', __('Alphabetical: Descending (Z &ndash; A)', 'example'), $args, false );
}

?></code></pre>
<p>In your views list, you should now be able to click on either of these views and see what happens.</p>
<h2>Custom view templates</h2>
<p>By default, bbPress will use your theme&#8217;s <code>view.php</code> template to display a view.  Sometimes, you might want to create an entirely custom template though, which is perfectly fine.</p>
<p>For the sake of simplicity, we&#8217;ll create two new templates with the same names as our views from above:  <code>alphabetical-ascending.php</code> and <code>alphabetical-descending.php</code>.  Place those files in your theme&#8217;s folder.</p>
<p>Then, add this code to your <code>functions.php</code> file:</p>
<pre><code>&lt;?php

add_action( 'bb_custom_view', 'my_custom_views_templates' );

function my_custom_views_templates( $view ) {

	if ( 'alphabetical-ascending' == $view ) {
		bb_load_template( 'alphabetical-ascending.php' );
		exit();
	}
	elseif ( 'alphabetical-descending' == $view ) {
		bb_load_template( 'alphabetical-descending.php' );
		exit();
	}
}

?></code></pre>
<p>Of course, what goes in your custom templates is entirely up to you.  Use your imagination.</p>
<p class="note">Note:  There may be a more elegant way to load custom view templates, so if you have suggestions, I&#8217;d love to hear them.</p>
<h2>How to list your views</h2>
<p>Most bbPress themes will likely list your views somewhere within the theme, but if yours doesn&#8217;t, just drop this code wherever you need to list them:</p>
<pre><code>&lt;ul>
	&lt;?php foreach ( bb_get_views() as $view => $title ) : ?>
		&lt;li class="view">&lt;a href="&lt;?php view_link( $view ); ?>" title="&lt;?php view_name( $view ); ?>">&lt;?php view_name( $view ); ?>&lt;/a>&lt;/li>
	&lt;?php endforeach; ?>
&lt;/ul></code></pre>
<h2>Views are not pages</h2>
<p>On a final note, I wanted to point out that views are not pages.  bbPress is not a <acronym title="Content Management System">CMS</acronym> like WordPress, which is what you&#8217;d use to create things like pages.  One could use views to create <em>ad hoc</em> pages, but this seems a bit crude.</p>
<p>I can see the need for something like a page feature for forum-only sites, but I&#8217;ll leave that discussion for another time.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2009/07/15/how-to-create-custom-views-in-bbpress/feed</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How to create a forums list in bbPress</title>
		<link>http://justintadlock.com/archives/2009/05/03/how-to-create-a-forums-list-in-bbpress</link>
		<comments>http://justintadlock.com/archives/2009/05/03/how-to-create-a-forums-list-in-bbpress#comments</comments>
		<pubDate>Sun, 03 May 2009 23:40:58 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[bbPress]]></category>
		<category><![CDATA[bbPress Tutorials]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=1639</guid>
		<description><![CDATA[How to create a list of your forums for bbPress with a link to each forum, its <acronym title="Really Simple Syndication">RSS</acronym> feed, and number of posts.]]></description>
			<content:encoded><![CDATA[<p><span class="drop-cap">W</span>hile redesigning the Theme Hybrid <a href="http://themehybrid.com/support" title="Theme Hybrid support forums">support</a> and <a href="http://themehybrid.com/community" title="Theme Hybrid community forums">community</a> forums, I needed an easy way to show off the list of forums with links to the <acronym title="Really Simple Syndication">RSS</acronym> feeds and number of posts next to each forum name.  </p>
<p>What I&#8217;ll be showing you in this tutorial is a simple way to do this.</p>
<p>I prefer to have the list of forums in the sidebar while showing the most recent posts in the content area.  But, you can use this code in any of your template files for use anywhere on your forums.</p>
<h2>The code</h2>
<p>What we&#8217;ll be doing is using the <code>get_forums()</code> function to grab an array of all of your forums.  Then, we&#8217;ll loop through the array, listing a link to each forum, showing the number of posts, and linking to the <acronym title="Really Simple Syndication">RSS</acronym> feed.</p>
<pre><code>&lt;div class="forums-list"&gt;

	&lt;h3&gt;Forums&lt;/h3&gt;

	&lt;ul&gt;

	&lt;?php $forums = get_forums(); ?&gt;
	&lt;?php foreach ( $forums as $forum ) : ?&gt;

		&lt;li&gt;
			&lt;a class="forum-link" href="&lt;?php forum_link( $forum-&gt;forum_id ); ?&gt;"&gt;&lt;?php forum_name( $forum-&gt;forum_id ); ?&gt;&lt;/a&gt;
			&lt;span class="forum-posts"&gt;(&lt;?php forum_posts( $forum-&gt;forum_id ); ?&gt; posts)&lt;/span&gt;
			&lt;a class="rss-link" href="&lt;?php bb_forum_posts_rss_link( $forum-&gt;forum_id ); ?&gt;"&gt;(&lt;abbr title="Really Simple Syndication"&gt;RSS&lt;/abbr&gt;)&lt;/a&gt;
		&lt;/li&gt;

	&lt;?php endforeach; ?&gt;

	&lt;/ul&gt;

&lt;/div&gt;</code></pre>
<h2>The finished product</h2>
<p>I worked a little extra <acronym title="Cascading Style Sheets">CSS</acronym> magic on mine and came up with this:</p>
<p><img src="http://justintadlock.com/blog/wp-content/uploads/2009/05/bbpress-forums-list.png" alt="bbPress Forums List" title="bbPress Forums List" width="600" height="343" class="aligncenter size-full wp-image-1640" /></p>
<p>I hope you have fun with this code and come up with more unique ways to show off your forums.  I provided a few <acronym title="Cascading Style Sheets">CSS</acronym> classes to help you out if you want to add your own style.  Here they are for reference:</p>
<pre><code>/* Containing &lt;div&gt; */
.forums-list {}

/* Header */
.forums-list h3 {}

/* List */
.forums-list ul {}
.forums-list li {}

/* Forum link */
a.forum-link {}

/* Number of forum posts */
span.forum-posts {}

/* Forum RSS Link */
a.rss-link {}</code></pre>
<h2>More bbPress tutorials and discussion to come</h2>
<p>I&#8217;m not really sure how many folks are using <a href="http://bbpress.org" title="bbPress forum software">bbPress</a> these days, but it&#8217;s the forum software of choice for me.  It&#8217;s simple and lightweight &mdash; everything I need in forum software.  I hope that I can bring more people to this platform and do my part in helping the bbPress community grow.</p>
<p>I also hope to continue writing more tutorials like this one, so there&#8217;ll be more documentation out there.  If you have ideas for tutorials, I&#8217;ll see if I can squeeze them in sometime.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2009/05/03/how-to-create-a-forums-list-in-bbpress/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Bringin&#8217; sexy to&#8230;bbPress?</title>
		<link>http://justintadlock.com/archives/2008/07/06/bringin-sexy-tobbpress</link>
		<comments>http://justintadlock.com/archives/2008/07/06/bringin-sexy-tobbpress#comments</comments>
		<pubDate>Sun, 06 Jul 2008 22:35:33 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[bbPress]]></category>

		<guid isPermaLink="false">http://justintadlock.com/?p=954</guid>
		<description><![CDATA["bbPress is still like the Wild West."

This is what Chris Hajer had to say about bbPress in a <a href="http://bbpress.org/forums/topic/template-tags#post-4816" title="bbPress is like the Wild West"> forum topic</a> about a year ago.]]></description>
			<content:encoded><![CDATA[<blockquote><p>
&#8220;bbPress is still like the Wild West.&#8221;
</p></blockquote>
<p>This is what Chris Hajer had to say about bbPress in a <a href="http://bbpress.org/forums/topic/template-tags#post-4816" title="bbPress is like the Wild West"> forum topic</a> about a year ago.</p>
<p>This statement still holds true today.  There isn&#8217;t a vast database of knowledge like we have with the <a href="http://codex.wordpress.org" title="WordPress Codex"> WordPress Codex</a>.  There are only a handful of useful plugins.</p>
<p>More importantly, there aren&#8217;t enough themes.</p>
<p>The themes out there look a lot like the choices we had a few years ago with WordPress: solid foundations for a system in its infancy.</p>
<p>I think a lot of WordPress users shy away from using bbPress as their forum software because there&#8217;s just not as many choices as there are with other forum packages when it comes to themes.</p>
<p>Well, I&#8217;m going to try and change that.</p>
<h3>What&#8217;s bbPress?</h3>
<p>If you don&#8217;t know what bbPress is, then you can always read about it at the <a href="http://bbpress.org" title="bbPress"> bbPress Site</a>.</p>
<p>In a nutshell, it&#8217;s forum, or message board, software by our beloved WordPress team.</p>
<p>From the bbPress <a href="http://bbpress.org/about" title="About bbPress"> about page</a>:</p>
<blockquote><p>
bbPress is plain and simple forum software, plain and simple. It’s easy to use, easy to administrate, fast and clean. But don’t let its simplicity deceive you; underneath the gleam, it’s got some powerful features and is highly customizable.
</p></blockquote>
<h3>Coming bbPress themes</h3>
<p>If you&#8217;ve been wondering why I haven&#8217;t blogged much lately, this is why.  I&#8217;ve been busily putting together five different bbPress themes.  This sytem is a beast that&#8217;s not easily tamed.</p>
<p>Here&#8217;s a gallery of what&#8217;s to come.  Note that two of the themes are for Project M&#8217;s design (support and ideas forum themes).</p>

<a href='http://justintadlock.com/archives/2008/07/06/bringin-sexy-tobbpress/bbpress-structure' title='Structure Theme'><img width="150" height="150" src="http://justintadlock.com/blog/wp-content/uploads/2008/07/bbpress-structure-150x150.gif" class="attachment-thumbnail" alt="Structure Theme" title="Structure Theme" /></a>
<a href='http://justintadlock.com/archives/2008/07/06/bringin-sexy-tobbpress/project-m-ideas' title='Project M Ideas'><img width="150" height="150" src="http://justintadlock.com/blog/wp-content/uploads/2008/07/project-m-ideas-150x150.gif" class="attachment-thumbnail" alt="Project M Ideas" title="Project M Ideas" /></a>
<a href='http://justintadlock.com/archives/2008/07/06/bringin-sexy-tobbpress/project-m-support' title='Project M Support'><img width="150" height="150" src="http://justintadlock.com/blog/wp-content/uploads/2008/07/project-m-support-150x150.gif" class="attachment-thumbnail" alt="Project M Support" title="Project M Support" /></a>
<a href='http://justintadlock.com/archives/2008/07/06/bringin-sexy-tobbpress/bbpress-options-blue' title='Options Theme Blue'><img width="150" height="150" src="http://justintadlock.com/blog/wp-content/uploads/2008/07/bbpress-options-blue-150x150.gif" class="attachment-thumbnail" alt="Options Theme Blue" title="Options Theme Blue" /></a>
<a href='http://justintadlock.com/archives/2008/07/06/bringin-sexy-tobbpress/bbpress-options-dark' title='Options Theme Dark'><img width="150" height="150" src="http://justintadlock.com/blog/wp-content/uploads/2008/07/bbpress-options-dark-150x150.gif" class="attachment-thumbnail" alt="Options Theme Dark" title="Options Theme Dark" /></a>

<p>I know, they&#8217;re not too advanced yet, but these are just the initial templates.  I&#8217;ll try to branch out with the designs a bit.</p>
<h3>Pushing for more bbPress users</h3>
<p>This is my way of asking more people to move over to bbPress.</p>
<p>It&#8217;s in its infancy, but the more people we have working on it and using it, the better it becomes.</p>
<p>If you&#8217;re using one of my WordPress themes, you can look forward to an accompanying bbPress theme.</p>
<h3>What do you think?</h3>
<p>Everything&#8217;s pretty basic right now, but I had to get the design elements down.  The most important thing is to make solidly coded themes to build upon.</p>
<p>I&#8217;m sure I&#8217;ll be adding neat things such as tabs to the sidebar, so don&#8217;t worry about that.</p>
<p>I&#8217;ll also be releasing some <em> alpha</em> versions of the Options and Structure themes for bbPress in my forums.  So, if you&#8217;re using one of those WordPress themes and are interested in testing, check out the bbPress <a href="http://justintadlock.com/forums/topic.php?id=1111" title="bbPress alpha theme testing"> testing thread</a> in the forums.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2008/07/06/bringin-sexy-tobbpress/feed</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>New forums for my site</title>
		<link>http://justintadlock.com/archives/2008/02/09/new-forums-for-my-site</link>
		<comments>http://justintadlock.com/archives/2008/02/09/new-forums-for-my-site#comments</comments>
		<pubDate>Sat, 09 Feb 2008 19:37:19 +0000</pubDate>
		<dc:creator>Justin Tadlock</dc:creator>
				<category><![CDATA[Updates]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[bbPress]]></category>

		<guid isPermaLink="false">http://justintadlock.com/archives/2008/02/09/new-forums-for-my-site</guid>
		<description><![CDATA[I finally decided to create a message board for this site, which I&#8217;ll mostly use for WordPress theme support. Right now, it&#8217;s entirely experimental, and I want to know what you think. Check out the forums. After a lot of nagging from users of the Structure theme and finally getting some time to work on [...]]]></description>
			<content:encoded><![CDATA[<p>I finally decided to create a message board for this site, which I&#8217;ll mostly use for WordPress theme support.  Right now, it&#8217;s entirely experimental, and I want to know what you think.  Check out the <a href="http://justintadlock.com/forums" title="Justin Tadlock's Forums"> forums</a>.</p>
<p>After a lot of <em> nagging</em> from users of the <a href="http://justintadlock.com/archives/2007/12/09/structure-wordpress-theme" title="Structure WordPress theme"> Structure theme</a> and finally getting some time to work on it, I decided to put this thing together.</p>
<p>One of the reasons it took me so long to get a forum up was because I was torn between which forum to use.  I checked out what other theme designers were using.  Darren Hoyt is using <a href="http://getvanilla.com" title="Vanilla"> Vanilla</a> for his <a href="http://www.darrenhoyt.com/forums/mimbo/" title="Mimbo Forums"> Mimbo forums</a>.  Small Potato is using <a href="http://vbulletin.com" title="vBulletin"> vBulletin</a> for the <a href="http://www.wpdesigner.com/forums/" title="WPDesigner Forums"> WPDesigner Forums</a>.  The <a href="http://www.wpsnap.com/blog/forum/" title="WP Snap Forum"> WP Snap Forum</a> is powered by <a href="http://bbpress.org" title="bbPress"> bbPress</a>.  Plus, I had to seriously consider using the <a href="http://www.stuff.yellowswordfish.com/simple-forum/" title="Simple Forum WordPress plugin"> Simple Forum</a> plugin.</p>
<p>There doesn&#8217;t seem to be any widespread agreement on which forum software or plugin to use.  In the end, I decided to use bbPress.  I really wanted to use Simple Forum because of its easy integration but didn&#8217;t like all the bells and whistles.  I wanted the more lightweight bbPress, even if it was a pain to integrate.</p>
<h3>Some problems</h3>
<p>One of the major problems I had was getting permalinks to work.  I&#8217;m not sure why it&#8217;s such a problem because my WordPress install works great.  Most of the threads I found on the bbPress support forums regarding permalinks were about GoDaddy.  Unfortunately, I&#8217;m still using their hosting service.  I can&#8217;t remember what thread I found this code on, but it fixed my permalink problem.</p>
<p>You need to edit your &#8220;.htaccess&#8221; file for this.  Put this code in in the file (the top two lines should help GoDaddy users):</p>
<pre><code>AddHandler x-httpd-php5 .php
AddHandler x-httpd-php .php4

Options +MultiViews</code></pre>
<p>Another problem I ran into was not being able to create new forums as an administrator.  This was caused by one of the most popular plugins (one that&#8217;s definitely needed), <a href="http://bbpress.org/plugins/topic/display-name/" title="Use Display Name"> Display Name</a>.</p>
<p>To correct this, just deactivate the plugin when you need to create a new forum.  Then, reactivate it.  Problem solved.</p>
<h3>Why did I choose bbPress?</h3>
<p>I chose bbPress for several reasons.</p>
<ul>
<li><a href="http://bbpress.org/blog/2008/01/the-future-for-bbpress/" title="The future for bbPress">The future for bbPress</a> is looking up.  I trust Matt and co. will continue building upon the software with an extra <a href="http://gigaom.com/2008/01/22/wordpresscom-creator-raises-29m/" title="WordPress.com Creator Raises $29.5 M"> $29.5 million</a> laying around.</li>
<li>I like the open-source community of WordPress.  If bbPress gets revamped, I believe the WordPress community will embrace it.  This means more people helping out at the support forums and better documentation.</li>
<li>Even though it was a pain to integrate because of my permalink situation, it&#8217;s nice to be able use other WordPress functions easily.</li>
<li>Easy to modify with the template system.</li>
<li>Very lightweight compared to other forum scripts.</li>
</ul>
<h3>What do you think?</h3>
<p>I&#8217;m sure there are some bugs, but you should go play around on the <a href="http://justintadlock.com/forums" title="Justin Tadlock's Forums"> forums</a> a bit.  I even have a practice forum set up for now.</p>
<p>Another thing that&#8217;s been bothering me is the naming situation.  Since I&#8217;m still in the early experimental stages, I can still change the name.  Currently, it&#8217;s &#8220;forums.&#8221;  I think &#8220;forum&#8221; sounds better, but I don&#8217;t like the forum slugs, which would look like &#8220;/forum/forum/forum-name&#8221; using that naming convention.  Most of all, I like &#8220;message board&#8221; but figured it was a bit too long.</p>
<p>Go give the forums a test drive and let me know what you think.  I do need a few lab rats to help test it.</p>
]]></content:encoded>
			<wfw:commentRss>http://justintadlock.com/archives/2008/02/09/new-forums-for-my-site/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>

