<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>bbPress support forums Topic: Display latest post from WP</title>
<link>http://bbpress.org/forums/</link>
<description>bbPress support forums Topic: Display latest post from WP</description>
<language>en</language>
<pubDate>Wed, 03 Dec 2008 03:35:07 +0000</pubDate>

<item>
<title>articles2u on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-18234</link>
<pubDate>Wed, 13 Aug 2008 04:58:58 +0000</pubDate>
<dc:creator>articles2u</dc:creator>
<guid isPermaLink="false">18234@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;- Display WP posts in bbpress forums&#60;br /&#62;
- Display bbpress topics in WP&#60;/p&#62;
&#60;p&#62;Very intresting post. I want to use this plugin.
&#60;/p&#62;</description>
</item>
<item>
<title>Krystian on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-18177</link>
<pubDate>Tue, 12 Aug 2008 04:29:11 +0000</pubDate>
<dc:creator>Krystian</dc:creator>
<guid isPermaLink="false">18177@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;ok, this plugin doesnt work with bbpress 0.9.0.2&#60;/p&#62;
&#60;p&#62;if somebody know how to show the WP recent posts on BBPress please let me know. &#60;/p&#62;
&#60;p&#62;thanks&#60;br /&#62;
Krystian
&#60;/p&#62;</description>
</item>
<item>
<title>burtton on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-10780</link>
<pubDate>Wed, 05 Sep 2007 04:53:56 +0000</pubDate>
<dc:creator>burtton</dc:creator>
<guid isPermaLink="false">10780@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Which edition of WP do you use? 2.0.4 or 2.1? The newest edition allows you to display latest post from wordpress.Just update your WP However, I have a problem too.How could I make a pluging of Audio Player into my blog? I've tried several times,but it said: fail to link!
&#60;/p&#62;</description>
</item>
<item>
<title>rbytes on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-8760</link>
<pubDate>Sun, 08 Jul 2007 08:47:19 +0000</pubDate>
<dc:creator>rbytes</dc:creator>
<guid isPermaLink="false">8760@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Very interesting solution to display latest post from wordpress, i'll try it!
&#60;/p&#62;</description>
</item>
<item>
<title>fel64 on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-4879</link>
<pubDate>Sun, 25 Feb 2007 18:09:06 +0000</pubDate>
<dc:creator>fel64</dc:creator>
<guid isPermaLink="false">4879@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Yup, I know that; I just meant that you could quite simply add it to the arguments you took and it'd be a nice addition. My modified code at the end.&#60;/p&#62;
&#60;p&#62;Yeah, it's mildly annoying that the permalinks aren't used, but it's not a killer for me. I'd rather have this functionality than none. :) Thanks again for the plugin.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function wp_show_posts( $args ) {
	global $bb;

	parse_str($args, $r);
	if ( !isset( $r[&#38;#39;before&#38;#39;] ) )
		$r[&#38;#39;before&#38;#39;] = \&#38;quot;&#38;lt;li&#38;gt;\n\&#38;quot;;
	if ( !isset( $r[&#38;#39;after&#38;#39;] ) )
		$r[&#38;#39;after&#38;#39;] = \&#38;quot;&#38;lt;br /&#38;gt;\n&#38;lt;/li&#38;gt;\n\&#38;quot;;
	$posts = wp_get_posts( $args );
	foreach( $posts as $post ) {
		echo $r[&#38;#39;before&#38;#39;];
		echo \&#38;quot;&#38;lt;a href=&#38;#39;\&#38;quot;.$bb-&#38;gt;wp_home.\&#38;quot;?p=\&#38;quot;.$post-&#38;gt;ID.\&#38;quot;&#38;#39;&#38;gt;\&#38;quot;;
		echo $post-&#38;gt;post_title;
		echo \&#38;quot;&#38;lt;/a&#38;gt;\&#38;quot;;
		echo $r[&#38;#39;after&#38;#39;];
	}
}&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>NickBrady on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-4877</link>
<pubDate>Sun, 25 Feb 2007 17:38:11 +0000</pubDate>
<dc:creator>NickBrady</dc:creator>
<guid isPermaLink="false">4877@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Hi, fel64, you can use wp_get_posts() instead of wp_show_posts() and then use a foreach loop, much like the &#60;a href=&#34;http://codex.wordpress.org/Template_Tags/get_posts&#34;&#62;examples in the WP Codex for the get_posts function&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;You don't mind that pretty permalinks are not being used? I think it's a killer, let's hope some expert can help us.
&#60;/p&#62;</description>
</item>
<item>
<title>fel64 on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-4875</link>
<pubDate>Sun, 25 Feb 2007 17:31:36 +0000</pubDate>
<dc:creator>fel64</dc:creator>
<guid isPermaLink="false">4875@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Fantastic Nick, worked straight out of the box. I really like the way you take arguments as well. :)  Nicest addition would be a &#60;code&#62;before&#60;/code&#62; and &#60;code&#62;after&#60;/code&#62; so that it didn't have to be a list.
&#60;/p&#62;</description>
</item>
<item>
<title>NickBrady on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-4873</link>
<pubDate>Sun, 25 Feb 2007 15:38:08 +0000</pubDate>
<dc:creator>NickBrady</dc:creator>
<guid isPermaLink="false">4873@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I am writing a plugin for BBPress that shows the latest posts from WP (if WP and BBPress are sharing the same database). It's still in development, but it already works, you just have to write&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;
&#38;lt;?php wp_show_posts(\\&#38;quot;\\&#38;quot; ); ?&#38;gt;
&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;in any BBpress template.&#60;/p&#62;
&#60;p&#62;As you will see, it works, but it has a problem: it does not show WP's &#60;strong&#62;pretty URLs&#60;/strong&#62;. I would like to call WP's get_permalink() function, but it uses many WP functions that are not available when you're in BBPress. &#60;/p&#62;
&#60;p&#62;Any advice on how to do this? Or maybe it would be easier to read WP's RSS?&#60;/p&#62;
&#60;p&#62;Thanks!&#60;/p&#62;
&#60;p&#62;Here goes the code of the plugin so far (if you don't care about pretty permalinks, you can use it, it works):&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;
&#38;lt;?php
/*
Plugin Name: WP Posts
Plugin URI: &#60;a href=&#34;http://thesandbox.wordpress.com&#34; rel=&#34;nofollow&#34;&#62;http://thesandbox.wordpress.com&#60;/a&#62;
Description: Get a list of Wordpress posts from your bbPress (needs to be integrated with WP, sharing database)
Author: Nick Brady
Version: 0.1
Author URI: &#60;a href=&#34;http://thesandbox.wordpress.com&#34; rel=&#34;nofollow&#34;&#62;http://thesandbox.wordpress.com&#60;/a&#62;

Install Instructions:
- If you don&#38;#39;t have a /my-plugins/ directory in your bbpress installaltion, create it on the same level as config.php.

- Check out: &#60;a href=&#34;http://codex.wordpress.org/Template_Tags/get_posts&#34; rel=&#34;nofollow&#34;&#62;http://codex.wordpress.org/Template_Tags/get_posts&#60;/a&#62;

*/

function wp_get_posts($args) {
	global $bbdb, $bb;

	parse_str($args, $r);
	if ( !isset($r[&#38;#39;numberposts&#38;#39;]) )
		$r[&#38;#39;numberposts&#38;#39;] = 5;
	if ( !isset($r[&#38;#39;offset&#38;#39;]) )
		$r[&#38;#39;offset&#38;#39;] = 0;
	if ( !isset($r[&#38;#39;category&#38;#39;]) )
		$r[&#38;#39;category&#38;#39;] = &#38;#39;&#38;#39;;
	if ( !isset($r[&#38;#39;orderby&#38;#39;]) )
		$r[&#38;#39;orderby&#38;#39;] = &#38;#39;post_date&#38;#39;;
	if ( !isset($r[&#38;#39;order&#38;#39;]) )
		$r[&#38;#39;order&#38;#39;] = &#38;#39;DESC&#38;#39;;

	$now = bb_current_time(&#38;#39;mysql&#38;#39;);

	$posts = $bbdb-&#38;gt;get_results(
		\\&#38;quot;SELECT DISTINCT * FROM \\&#38;quot;.$bb-&#38;gt;wp_table_prefix.\\&#38;quot;posts \\&#38;quot; .
		( empty( $r[&#38;#39;category&#38;#39;] ) ? \\&#38;quot;\\&#38;quot; : \\&#38;quot;, \\&#38;quot;.$bb-&#38;gt;wp_table_prefix.\\&#38;quot;post2cat \\&#38;quot; ) .
		\\&#38;quot; WHERE post_date &#38;lt;= &#38;#39;$now&#38;#39; AND (post_status = &#38;#39;publish&#38;#39;) \\&#38;quot;.
		( empty( $r[&#38;#39;category&#38;#39;] ) ? \\&#38;quot;\\&#38;quot; : \\&#38;quot;AND \\&#38;quot;.$bb-&#38;gt;wp_table_prefix.\\&#38;quot;posts.ID = \\&#38;quot;.$bb-&#38;gt;wp_table_prefix.\\&#38;quot;post2cat.post_id AND \\&#38;quot;.$bb-&#38;gt;wp_table_prefix.\\&#38;quot;post2cat.category_id = \\&#38;quot; . $r[&#38;#39;category&#38;#39;]. \\&#38;quot; \\&#38;quot; ) .
		\\&#38;quot; GROUP BY \\&#38;quot;.$bb-&#38;gt;wp_table_prefix.\\&#38;quot;posts.ID ORDER BY \\&#38;quot; . $r[&#38;#39;orderby&#38;#39;] . \\&#38;quot; \\&#38;quot; . $r[&#38;#39;order&#38;#39;] . \\&#38;quot; LIMIT \\&#38;quot; . $r[&#38;#39;offset&#38;#39;] . &#38;#39;,&#38;#39; . $r[&#38;#39;numberposts&#38;#39;] );

	return $posts;
}

function wp_show_posts( $args ) {
	global $bb;
	$posts = wp_get_posts( $args );
	foreach( $posts as $post ) {
		echo \\&#38;quot;&#38;lt;li&#38;gt;\n\\&#38;quot;;
		echo \\&#38;quot;&#38;lt;a href=&#38;#39;\\&#38;quot;.$bb-&#38;gt;wp_home.\\&#38;quot;?p=\\&#38;quot;.$post-&#38;gt;ID.\\&#38;quot;&#38;#39;&#38;gt;\\&#38;quot;;
		echo $post-&#38;gt;post_title;
		echo \\&#38;quot;&#38;lt;/a&#38;gt;&#38;lt;br/&#38;gt;\n\\&#38;quot;;
		echo \\&#38;quot;&#38;lt;/li&#38;gt;\n\\&#38;quot;;
	}
}
?&#38;gt;
&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>fel64 on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-4756</link>
<pubDate>Thu, 22 Feb 2007 18:11:14 +0000</pubDate>
<dc:creator>fel64</dc:creator>
<guid isPermaLink="false">4756@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Any update on that plugin?
&#60;/p&#62;</description>
</item>
<item>
<title>softsea on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-4552</link>
<pubDate>Fri, 16 Feb 2007 09:02:19 +0000</pubDate>
<dc:creator>softsea</dc:creator>
<guid isPermaLink="false">4552@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;interesting too, &#60;/p&#62;
&#60;p&#62;not lost display WP Comments.
&#60;/p&#62;</description>
</item>
<item>
<title>NickBrady on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-4551</link>
<pubDate>Fri, 16 Feb 2007 08:51:56 +0000</pubDate>
<dc:creator>NickBrady</dc:creator>
<guid isPermaLink="false">4551@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;that was fast! ;-)&#60;/p&#62;
&#60;p&#62;Very interesting, I see you're doing both things:&#60;br /&#62;
- Display WP posts in bbpress forums&#60;br /&#62;
- Display bbpress topics in WP&#60;/p&#62;
&#60;p&#62;Are these two different plugins? I guess it's one for WP and one for bbpress.&#60;/p&#62;
&#60;p&#62;Looking forward to those plugins! ;-)
&#60;/p&#62;</description>
</item>
<item>
<title>MrPapasWorld on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-4550</link>
<pubDate>Fri, 16 Feb 2007 08:41:00 +0000</pubDate>
<dc:creator>MrPapasWorld</dc:creator>
<guid isPermaLink="false">4550@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;finalizing a plugin... it includes a sidebar function and and page function...&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://test.klasen.us&#34; rel=&#34;nofollow&#34;&#62;http://test.klasen.us&#60;/a&#62;   for the sidebar function&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://test.158th.com&#34; rel=&#34;nofollow&#34;&#62;http://test.158th.com&#60;/a&#62; for the main page latest forum topcis functions...&#60;/p&#62;
&#60;p&#62;should be all one wp plugin soon..
&#60;/p&#62;</description>
</item>
<item>
<title>NickBrady on "Display latest post from WP"</title>
<link>http://bbpress.org/forums/topic/display-latest-post-from-wp#post-4548</link>
<pubDate>Fri, 16 Feb 2007 08:35:39 +0000</pubDate>
<dc:creator>NickBrady</dc:creator>
<guid isPermaLink="false">4548@http://bbpress.org/forums/</guid>
<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I'm setting up a bbpress forum linked to a WP blog. Is there any way I can show the latest posts of the blog in the forums sidebar?&#60;/p&#62;
&#60;p&#62;The forums and the blog use the same database, is there any way to get the latest posts from the database. If not, maybe reading the RSS of the blog, using a function like wp_rss() in WP. &#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
</item>

</channel>
</rss>
