<?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>Galen Grover &#187; CMS</title>
	<atom:link href="http://www.galengrover.com/tag/cms/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.galengrover.com</link>
	<description>web developer, mariokart expert, professional sitter</description>
	<lastBuildDate>Wed, 21 Dec 2011 20:02:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>WordPress as a CMS</title>
		<link>http://www.galengrover.com/wordpress/wordpress-as-a-cms/</link>
		<comments>http://www.galengrover.com/wordpress/wordpress-as-a-cms/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 22:19:52 +0000</pubDate>
		<dc:creator>Galen</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[CMS]]></category>

		<guid isPermaLink="false">http://www.galengrover.com/?p=58</guid>
		<description><![CDATA[This tutorial is aimed at developers who just want wordpress to function as a lightweight CMS, that is, wordpress will only be used for editing page content. First install wordpress in whatever directory you want the admin to live. I chose /admin. Any page that needs to use wordpress functionality you must add this: require&#40;'/path/to/wp-blog-header.php'&#41;; [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial is aimed at developers who just want wordpress to function as a lightweight CMS, that is, wordpress will only be used for editing page content.</p>
<p>First install <a href="http://wordpress.org/download/">wordpress</a> in whatever directory you want the admin to live. I chose <code>/admin</code>.</p>
<p>Any page that needs to use wordpress functionality you must add this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/path/to/wp-blog-header.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This gives you access to wordpress functions that we need:</p>
<ul>
<li><a href="http://codex.wordpress.org/Function_Reference/get_page">get_page</a> &#8211; Get the page data from the database</li>
<li><a href="http://codex.wordpress.org/Function_Reference/wpautop">wpautop</a> &#8211; Automatically add paragraph tags to page content</li>
</ul>
<p class="top-margin">To get page content:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$page_data</span> <span style="color: #339933;">=</span> get_page<span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">4</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Where 4 is the page ID in wordpress</span></pre></div></div>

<p>There is a <a href="http://bugs.php.net/bug.php?id=33643">bug</a> in certain versions of php, if you get the error:</p>
<blockquote><p>Fatal error: Only variables can be passed by reference&#8230;</p></blockquote>
<p>Then use this format instead:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$page_id</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$page_data</span> <span style="color: #339933;">=</span> get_page<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$page_id</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><code>$page_data</code> now contains all of the info for that page, and is ready for use in your templates/views. Check the <a href="http://codex.wordpress.org/Function_Reference/get_page">function reference</a> to see the data you have available to you.</p>
<p>To display <code>post_content</code> use the wp function <a href="http://codex.wordpress.org/Function_Reference/wpautop">wpautop</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?=</span> wpautop<span style="color: #009900;">&#40;</span><span style="color: #000088;">$page_data</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.galengrover.com/wordpress/wordpress-as-a-cms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

