<?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>Expressing IT &#187; WordPress API</title>
	<atom:link href="http://developer.expressionz.in/blogs/tag/wordpress-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://developer.expressionz.in/blogs</link>
	<description>User Interface : just another, but a serious developers weblog</description>
	<lastBuildDate>Thu, 20 May 2010 18:05:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>How to include a WordPress Blog in another site</title>
		<link>http://developer.expressionz.in/blogs/2009/02/02/how-to-include-a-wordpress-blog-in-another-site/</link>
		<comments>http://developer.expressionz.in/blogs/2009/02/02/how-to-include-a-wordpress-blog-in-another-site/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 06:52:59 +0000</pubDate>
		<dc:creator>Nikhil</dc:creator>
				<category><![CDATA[Web Developer]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[WordPress API]]></category>

		<guid isPermaLink="false">http://developer.expressionz.in/blogs/?p=52</guid>
		<description><![CDATA[This question crossed my mind a few times before, when I was working on sites earlier too, which used WordPress to show blogs or new kind of content in some part of the site/portal. Finally! this requirement came upto my nose, when started diggin around a bit for solution. I was surprised to find that it really was easier than I actually thought it was, to display a list of headlines or the latest post on any other page outside of the Wordpress-powered section, just using a little bit of PHP and the Wordpress API. ]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: left; margin-right: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fdeveloper.expressionz.in%2Fblogs%2F2009%2F02%2F02%2Fhow-to-include-a-wordpress-blog-in-another-site%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fdeveloper.expressionz.in%2Fblogs%2F2009%2F02%2F02%2Fhow-to-include-a-wordpress-blog-in-another-site%2F&amp;source=nikhild&amp;style=normal&amp;hashtags=PHP,Tips+%26amp%3B+Tricks,WordPress+API" height="61" width="50" /><br />
			</a>
		</div>
<p>This question crossed my mind a few times before, when I was working on sites earlier too, which used WordPress to show blogs or new kind of content in some part of the site/portal.Being a novice in PHP and around WordPress, I kept procastinating it, thinking &#8221; this isnt my peice of cake&#8221;. Finally! this requirement came upto my nose, when started diggin around a bit for solution.<br />
I was surprised to find that it really was easier than I actually thought it was, to display a list of headlines or the latest post on any other page outside of the Wordpress-powered section, just using a little bit of <span class="caps">PHP </span>and the Wordpress <span class="caps">API.</span></p>
<p><strong>Here is what to do :-<br />
</strong>For reasons of explanation, assume that your site is <a href="http://www.inchembur.com/">http://www.inchembur.com/</a> and you have the news section for this site on <a href="http://news.inchembur.com/">http://news.inchembur.com/</a> ( which is running WordPress). Now the requirement is to show the latest post from <a href="http://news.inchembur.com/">http://news.inchembur.com/</a> on the home page of the main site ,i.e. <a href="http://www.inchembur.com/index.php">http://www.inchembur.com/index.php</a></p>
<p><span class="caps"><strong>Step1:</strong> In your index.php add the following peice of code , Include the Wordpress API file. You can add this to the top of the page you want your post to appear on. </span></p>
<blockquote><p><span style="font-weight: bold; color: #000000;">&lt;?php</span><br />
<span style="color: #990000;">define</span><span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;WP_USE_THEMES&#8217;</span><span style="color: #339933;">,</span> <span style="font-weight: bold; color: #000000;">false</span><span style="color: #009900;">)</span><span style="color: #339933;">;  // Disbable use of Wordpress Theme</span><br />
<span style="color: #990000;">require <span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;/var/news.inchembur.com/wp-blog-header.php&#8217;); </span><span style="color: #339933;">// Include Wordpress API</span><br />
query_posts<span style="color: #009900;">(</span><span style="color: #0000ff;">&#8217;showposts=1&#8242;</span><span style="color: #009900;">)</span><span style="color: #339933;">; // Get Latest Post</span><br />
<span style="font-weight: bold; color: #000000;">?&gt;</span></span></p></blockquote>
<p>In the above peice of include , we are getting only the single most recent post. if you want to try more variations feel free to dig into,  <a href="http://codex.wordpress.org/Template_Tags/query_posts"><code>query_posts()</code> documentation</a> .</p>
<p><strong>Step 2: </strong>Now, In the part of the Index/Home page where you want to show the latest Wordpress post from <a href="http://news.inchembur.com">http://news.inchembur.com</a> , use the following code. Needless to say, feel free to ad your styling divisions, spans and classes as per your design needs.</p>
<p><strong>Step3 :</strong> There is no Step 3 &#8230; Thats it &#8230; you are done!</p>
<hr />OfCourse, You can try a few variations as per your requirements ( as I mentioned earlier, refer to <a href="http://codex.wordpress.org/Template_Tags/query_posts"><code>query_posts()</code> documentation</a> ) . Heres some taster &#8230;</p>
<p><strong>How show a specific post/page as opposed to the latest post:-</strong><br />
This can easily achived by altering the arguments to <code>query_posts()</code> to include the page ID or page slug</p>
<blockquote><p>query_posts<span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;page_id=7&#8242;</span><span style="color: #009900;">)</span><span style="color: #339933;">;<br />
</span>query_posts<span style="color: #009900;">(</span><span style="color: #0000ff;">&#8216;pagename=about&#8217;</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></p>
<p><strong>or You can control the number of posts:<br />
</strong>query_posts<span style="color: #009900;">(</span><span style="color: #0000ff;">showposts=3</span><span style="color: #009900;">)</span><span style="color: #339933;">;</span></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://developer.expressionz.in/blogs/2009/02/02/how-to-include-a-wordpress-blog-in-another-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
