
<?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>Sigerr</title>
	<atom:link href="http://www.sigerr.org/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sigerr.org</link>
	<description>Julien Bourdeau&#039;s personal website</description>
	<lastBuildDate>Sun, 07 Apr 2013 16:26:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Setup VSFTPD with custom multiple directories and (virtual) users accounts on Ubuntu (no database required)</title>
		<link>http://www.sigerr.org/linux/setup-vsftpd-custom-multiple-directories-users-accounts-ubuntu-step-by-step</link>
		<comments>http://www.sigerr.org/linux/setup-vsftpd-custom-multiple-directories-users-accounts-ubuntu-step-by-step#comments</comments>
		<pubDate>Sun, 03 Jun 2012 16:52:40 +0000</pubDate>
		<dc:creator>Julien Bourdeau</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[FTP]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://sigerr.org/?p=264</guid>
		<description><![CDATA[I wanted to install an FTP server on my servers, I check online and it turned up that VSFTPD is the most secure one so I started installing it. I&#8217;ve been through many tutorials and I couldn&#8217;t find any fully detailled ones so I decided to write mine. I have to explain, I set up VSFTPD [...]]]></description>
				<content:encoded><![CDATA[<p>I wanted to install an FTP server on my servers, I check online and it turned up that VSFTPD is the most secure one so I started installing it.</p>
<p>I&#8217;ve been through many tutorials and I couldn&#8217;t find any fully detailled ones so I decided to write mine. I have to explain, I set up VSFTPD on my personal server, <strong>wrote the tutorial step by step</strong> then followed my own tutorial to deploy VSFTPD <strong>on my production dedicated server</strong>.</p>
<h3>What we will do</h3>
<ol>
<li>Install vsftpd and a PAM library</li>
<li>Edit /etc/vsftpd.conf and /etc/pam.d/vsftpd</li>
<li>Create user accouts with custom directories (in /var/www/ for example)</li>
<li>Set directories with the correct chmod and chown</li>
<li><strong>Create a admin user with full access to the server</strong></li>
<li>Troubleshoot</li>
</ol>
<p><span id="more-264"></span></p>
<h2>1. Install vsftpd (Very Secure FTP Deamon) and libpam-pwdfile to create virtual users</h2>
<p>I wanted to create FTP users but I didn&#8217;t want to add local unix users (no shell access, no home directory and so on). A PAM (<strong>Pluggable Authentication Modules)</strong> will help us creating virtual users.</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get install</span> vsftpd libpam-pwdfile</div></div>

</pre>
<h2>2. Edit vsftpd.conf</h2>
<p>First we need to back up the original file</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd.conf <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd.conf.bak</div></div>

</pre>
<p>Then create a new one</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd.conf</div></div>

</pre>
<p>Copy and paste the following lines. The file <strong>should contains ONLY theses lines</strong>:</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">listen</span>=YES<br />
<span style="color: #007800;">anonymous_enable</span>=NO<br />
<span style="color: #007800;">local_enable</span>=YES<br />
<span style="color: #007800;">write_enable</span>=YES<br />
<span style="color: #007800;">local_umask</span>=022<br />
<span style="color: #007800;">nopriv_user</span>=vsftpd<br />
<span style="color: #007800;">virtual_use_local_privs</span>=YES<br />
<span style="color: #007800;">guest_enable</span>=YES<br />
<span style="color: #007800;">user_sub_token</span>=<span style="color: #007800;">$USER</span><br />
<span style="color: #007800;">local_root</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$USER</span><br />
<span style="color: #007800;">chroot_local_user</span>=YES<br />
<span style="color: #007800;">hide_ids</span>=YES<br />
<span style="color: #007800;">guest_username</span>=vsftpd</div></div>

</pre>
<h2>3. Register virtual users</h2>
<p>To register user we use htpasswd so I assume you have apache2 working on your server. Create a vsftpd folder, we&#8217;ll put configuration files in it.</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd</div></div>

</pre>
<p>then</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> htpasswd <span style="color: #660033;">-cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>ftpd.passwd user1</div></div>

</pre>
<ul>
<li><strong>-c</strong> means that we&#8217;ll create the file if it&#8217;s not existing yet</li>
<li><strong>-d</strong> forces MD5, you need it on ubuntu 12.04, just use it always</li>
</ul>
<div>The command will prompt for password.</div>
<p>If you want to add new users afterwards:</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> htpasswd <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>ftpd.passwd user2</div></div>

</pre>
<h2>4. Configure PAM in /etc/pam.d/vsftpd</h2>
<p>Again, we need to back up the orignal file</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pam.d<span style="color: #000000; font-weight: bold;">/</span>vsftpd <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pam.d<span style="color: #000000; font-weight: bold;">/</span>vsftpd.bak</div></div>

</pre>
<p>and create a new one</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pam.d<span style="color: #000000; font-weight: bold;">/</span>vsftpd</div></div>

</pre>
<p>Copy and paste these 2 lines (this should be the only content). I insist, I wasted a lot of time because I kept orignal lines and just added these.</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">auth required pam_pwdfile.so pwdfile <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>ftpd.passwd<br />
account required pam_permit.so</div></div>

</pre>
<h2>5. Create a local user without shell access</h2>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> useradd <span style="color: #660033;">--home</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vsftpd <span style="color: #660033;">--gid</span> nogroup <span style="color: #660033;">-m</span> <span style="color: #660033;">--shell</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">false</span> vsftpd</div></div>

</pre>
<p>You can check that it has been created with the id command: id vsftpd. We define the user with the /bin/false shell because of the <a href="https://security.appspot.com/vsftpd/vsftpd_conf.html"><em>check_shell</em> parameter</a> (even if we don&#8217;t use it).</p>
<div class="info_box">When the end user will connect to the FTP server, this user will be used for rights and ownership: chmod and chown.</div>
<h2>6. Restart vsftpd</h2>
<p>The common way is using init.d like all deamon</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>vsftpd restart</div></div>

</pre>
<p>In Ubuntu 12.04 there is something new with services. It worked on my 12.04 but not on my 10.04 one. To be honest I&#8217;m not a Linux expert (yet) so I can&#8217;t explain why. Something to do with <em>Upstart</em> I think.</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> service vsftpd restart</div></div>

</pre>
<h2>7. Create directories</h2>
<p>According to our configuration all users will be placed into there folder: <em><strong>/var/www/user1.</strong></em></p>
<p>You need to create them with particular rights: <strong>the root folder cannot be writable!</strong></p>
<ul>
<li> <strong>/</strong> [root = /var/www/user1]<strong> =&gt;</strong> <em>555</em>
<ul>
<li><strong>www</strong> [ /var/www/user1/www ] <strong>=&gt;</strong> <em>755</em></li>
<li><strong>docs</strong> [ /var/www/user1/docs ] =&gt; <em>755</em></li>
</ul>
</li>
</ul>
<div><div class="note_box"> Note: the user <strong>cannot</strong> create files or folders in the root directory.</div></div>
<p>In vsftpd.conf we have chroot_local_user=YES so the user can&#8217;t see anything outside his folder. To him the server looks like this:</p>
<p><a href="http://sigerr.org/linux/setup-vsftpd-custom-multiple-directories-users-accounts-ubuntu-step-by-step/attachment/login-ftp-vsftpd-chroot" rel="attachment wp-att-272"><img class="aligncenter size-large wp-image-272" title="login ftp vsftpd chroot" alt="" src="http://sigerr.org/wp-content/uploads/2012/06/login-ftp-vsftpd-chroot-680x428.jpg" width="540" height="339" /></a></p>
<p>Anyway, just run these commands:</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>user1<br />
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-w</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>user1<br />
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> www<span style="color: #000000; font-weight: bold;">/</span>user1<span style="color: #000000; font-weight: bold;">/</span>www<br />
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>user1<span style="color: #000000; font-weight: bold;">/</span>www<br />
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> vsftpd:nogroup <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>user1</div></div>

</pre>
<p>The<em> /var/www/user1</em> folder HAS TO exist or connection will fail.</p>
<p>Right now <strong>you can try to connect with your FTP client</strong> and it will succeed! If it doesn&#8217;t you can check the troubleshooting part.</p>
<h2>8. Create an Admin user to access the entire server</h2>
<p>To create an admin user we need to register a new user with htpasswd.</p>
<p>Before we do so, I&#8217;ll advice you to check into the /etc/ftpusers file that define certain users that are <strong>not</strong> allow to connect with ftp. I think it&#8217;s only for local users and not virtual users but just in case don&#8217;t choose a name contained into this file. Let&#8217;s be honest, vsftpd is complicated enough! ^^</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">sudo</span> htpasswd <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd<span style="color: #000000; font-weight: bold;">/</span>ftpd.passwd theadmin</div></div>

</pre>
<p>Now we need to add a new line into /etc/vsftpd.conf</p>
<pre>

<div class="codecolorer-container bash railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">chroot_list_enable</span>=YES</div></div>

</pre>
<p>This means that your user will be placed into their folder (as a jail) <strong>EXCEPT</strong> users into the <em><strong>/etc/vsftpd.chroot_list</strong></em></p>
<p>Let&#8217;s create this file and add our user, the file is a simple line containing &#8220;theadmin&#8221;. Add one user per line. That means we DON&#8217;T need to create a /var/www/theadmin folder, the user will login placed into /home/vsftpd.</p>
<p>Restart the server and you are done !</p>
<h2>Troubleshooting</h2>
<p>Here are some errors I had.</p>
<h3>500 OOPS: vsftpd: refusing to run with writable root inside chroot ()</h3>
<p>Your root directory is writable, this is not allowed. Check part 7 for more information, you need to create a 555 root and 755 subfolders</p>
<h3>500 OOPS: cannot change directory:/var/www/theadmin if the folder doesnt exist</h3>
<p>The /var/www/$USER folder doesn&#8217;t exist, create it with the correct rights (not writable) or add the user into the /etc/vsftpd.chroot_list (see part 8). Don&#8217;t forget to restart the server.</p>
<h3>htpasswd: cannot create file /etc/vsftpd/ftpd.passwd</h3>
<p>The /etc/vsftpd/ folder has to be existing, htpasswd won&#8217;t create it.</p>
<h3>vsftpd restart or stop error: &#8220;<em>restart: Unknown instance</em>&#8220;</h3>
<p>This means you can&#8217;t start the deamon even if you have success message with /etc/init.d/vsftpd start. It doesn&#8217;t start because your configuration is wrong. Start over this tutorial <img src='http://www.sigerr.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<h2>Sources</h2>
<p>Here are some websites that helped me</p>
<ul>
<li>My favorite one: <a href="http://www.debiantutorials.com/installing-vsftpd-using-text-file-for-virtual-users/">http://www.debiantutorials.com/installing-vsftpd-using-text-file-for-virtual-users/</a></li>
<li>The man page: <a href="https://security.appspot.com/vsftpd/vsftpd_conf.html">https://security.appspot.com/vsftpd/vsftpd_conf.html</a></li>
<li>this one says something about allow_writeable_chroot but it&#8217;s not in the man page: <a href="http://www.benscobie.com/fixing-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot/">http://www.benscobie.com/fixing-500-oops-vsftpd-refusing-to-run-with-writable-root-inside-chroot/</a></li>
<li><a href="http://ubuntuforums.org/showthread.php?t=518293">http://ubuntuforums.org/showthread.php?t=518293</a></li>
</ul>
<div class="note_box">If you want to create some sort of symlink to let your user access somewhere outside there chroot jail use <em><strong>mount &#8211;bind</strong></em><br />
<a href="http://backdrift.org/how-to-use-bind-mounts-in-linux">http://backdrift.org/how-to-use-bind-mounts-in-linux</a> </div>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sigerr.org/linux/setup-vsftpd-custom-multiple-directories-users-accounts-ubuntu-step-by-step/feed</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Bonne resolution 2011</title>
		<link>http://www.sigerr.org/perso/bonne-resolution-2011</link>
		<comments>http://www.sigerr.org/perso/bonne-resolution-2011#comments</comments>
		<pubDate>Mon, 09 Jan 2012 21:38:10 +0000</pubDate>
		<dc:creator>Julien Bourdeau</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://sigerr.org/?p=227</guid>
		<description><![CDATA[Every year at this period of time, you are motivated so you decide that you will change. I will change this year (again). Easy Take my medicine on a regular basis (my asthma need it). Brush my teeth 2 times a day. If I don’t want to end up as a rapper, it would be [...]]]></description>
				<content:encoded><![CDATA[<p>Every year at this period of time, you are motivated so you decide that you will change. I will change this year (again).</p>
<p><strong>Easy</strong></p>
<ol>
<li>Take my medicine on a regular basis (my asthma need it).</li>
<li>Brush my teeth 2 times a day. If I don’t want to end up as a rapper, it would be an idea.</li>
<li>Learn a new technology. I said it last year, this year I want to learn Python. I aslo want to start a PHP framework (CodeIgniter or Symfony).</li>
</ol>
<p><strong>Complicated</strong></p>
<ol>
<li>Become an early riser. I’m thinking about it for year, I have to do it now.</li>
<li>Eat better. I’m not even talking about weight, I have to eat less and healthier.</li>
<li>Read more. I bought some books some weeks ago and there is some I want to read, I should make time for this.</li>
</ol>
<p><strong>Extra and must be done</strong></p>
<ol>
<li>December 31st, 2012, I will weigh less than <strong>61Kg</strong>.</li>
</ol>
<p class="info_box">This post was originally <a href="http://1670mm.tumblr.com/post/15581930576">posted on Tumblr</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sigerr.org/perso/bonne-resolution-2011/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Un avenir pour LaSceneNantaise.net ? (french)</title>
		<link>http://www.sigerr.org/french/un-avenir-pour-lascenenantaise-net-french</link>
		<comments>http://www.sigerr.org/french/un-avenir-pour-lascenenantaise-net-french#comments</comments>
		<pubDate>Thu, 04 Aug 2011 09:59:49 +0000</pubDate>
		<dc:creator>Julien Bourdeau</dc:creator>
				<category><![CDATA[French]]></category>
		<category><![CDATA[lifestyle]]></category>
		<category><![CDATA[lsrn]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[nantes]]></category>
		<category><![CDATA[project]]></category>

		<guid isPermaLink="false">http://sigerr.org/?p=116</guid>
		<description><![CDATA[Quelques reflexions et pensées sur l&#8217;avenir de lascenenantaise.net. Il va y avoir 4 ans que Jo a créé le site de La Scene Nantaise, à cette époque il s&#8217;agissait d&#8217;un myspace annoncant tous les concerts interessants (de son point de vue, donc rock/metal/hardcore/alternatif/&#8230;) qui se passaient à Nantes. Il est ensuite parti à Londres pendant [...]]]></description>
				<content:encoded><![CDATA[<p>Quelques reflexions et pensées sur l&#8217;avenir de <em><a href="http://www.lascenenataise.net">lascenenantaise.net</a></em>. Il va y avoir 4 ans que Jo a créé le site de La Scene Nantaise, à cette époque il s&#8217;agissait d&#8217;un myspace annoncant tous les concerts interessants (de son point de vue, donc rock/metal/hardcore/alternatif/&#8230;) qui se passaient à Nantes. Il est ensuite parti à Londres pendant une année, je l&#8217;ai donc rejoint à ce moment là. Il est temps de penser à la version 3 du site, il s&#8217;agira surement d&#8217;un <span style="color: #bb1010;">agrégateur</span>. <span id="more-116"></span></p>
<h2>Rappel historique</h2>
<p style="text-align: center;"><a href="http://sigerr.org/french/un-avenir-pour-lascenenantaise-net-french/attachment/v1-la-scene-nantaise-site-internet" rel="attachment wp-att-118"><img class="aligncenter size-full wp-image-118" title="v1 la scene nantaise site internet" src="http://sigerr.org/wp-content/uploads/2011/07/v1-la-scene-nantaise-site-internet.jpg" alt="" width="680" /></a></p>
<p>On a dabors mis en ligne un premier site, toujours en ligne, <a href="http://v1.lascenenantaise.net/">http://v1.lascenenantaise.net/</a>, le deal etait donc, je m&#8217;occupe du site, il s&#8217;occupe du myspace (et du design du site). Mon tout premier site WordPress était en ligne! Après un petit moment, un an je crois, je me suis lancé dans un nouveau theme, un magazine (très en vogue à ce moment là). Bref Jo reprend le design en main. On essaie de mettre en ligne pas mal de page, il faut avouer qu&#8217;on était sur motivé. Pendant ce temps Jonathan a completement refait le myspace avec le même design. Cette v2 apportait pas mal de nouveauté, création d&#8217;un Twitter, intégration de Facebook Connect, et surtout ajout d&#8217;une page agenda généré à partir de la liste du <a href="http://www.myspace.com/lascenenantaise">myspace</a>(merci cURL).</p>
<p style="text-align: center;"><a href="http://lascenenantaise.net"><img class="aligncenter size-full wp-image-121" title="la scene nantaise wordpress v2" src="http://sigerr.org/wp-content/uploads/2011/07/la-scene-nantaise-wordpress-v2.jpg" alt="" width="680" /></a></p>
<p>Après la mise en ligne de la v2, on a vite remarqué que le rythme était trop soutenu et que ce genre de site demandait beaucoup de temps et beaucoup d&#8217;investissement pour être à jour. Il faut maintenir la liste des concerts sur myspace, ce qui est loin d&#8217;être une partie de plaisir mais surtout il faut rester au courant de tout ce qui se passe. Je me dis qu&#8217;il est grand temps de penser à une v3 qui pourrait enfin relancer le site. Il faut dire qu&#8217;il n&#8217;a casiment pas été mis à jour depuis 1 an et que, depuis la nouvelle version de myspace, la page agenda est hors-ligne.</p>
<h2>Nos erreurs</h2>
<p>Après un moment voilà ce que je retiendrais comme des erreurs.</p>
<p><strong>1. C&#8217;est un blog</strong><br />
Un blog demande de rédiger des billets, un minimum de contenu, des illustrations&#8230; donc du temps. A chaque information, chaque news, même les plus breves doivent être étoffé. Difficile d&#8217;imaginer un billet de moins de 100/120 mots et sans image.</p>
<p><strong>2. Un agenda trop limité</strong><br />
La page avec l&#8217;agenda complet est généré à partir du myspace, donc il s&#8217;agit simplement d&#8217;une date, les groupes et un lieux. Pas de details, pas de prix, pas de liens,&#8230; En fait l&#8217;agenda n’était qu&#8217;un gadget.</p>
<p><strong>3. Une mauvaise home page</strong><br />
La home page séparait les news en catégorie, donc pour pouvoir la renouveler il faut poster beaucoup de contenu&#8230; mauvais choix.</p>
<p><strong>4. Manque de contenu</strong><br />
Très clairement le site n&#8217;était pas assez étoffé. On en revient au problème 3 mais aussi au fait que personne ne prend l&#8217;habitude d&#8217;aller sur un site mis à jour 2 ou 3 fois par mois. Pas de visiteur régulier donc.</p>
<p><strong>5. Pas assez d&#8217;automatisme</strong><br />
La beauté de l&#8217;informatique c&#8217;est de pouvoir automatiser son travail. Il faut mieux passer beaucoup de temps au debut pour scripter quelques taches afin de se simplifier la vie ensuite. Le site n&#8217;était pas  suffisamment automatisé, besoin d&#8217;éditer des custom fields de wordpress, besoins d&#8217;ajouter l&#8217;ID du billet pour afficher une banniere en home page. Besoin d&#8217;editer le code pour afficher les flyers, bref beaucoup trop de temps perdu.</p>
<p><strong>6. Trop peu d&#8217;originalité</strong><br />
Surement le plus gros problème: le contenu. Trop peu d&#8217;originalité! La plupart des news avait été déjà publié sur <em>nantesmonamour.com</em> ou bien meme des sites comme <em>leboost</em>. Voila à mon sens les principaux problèmes, si vous avez des remarques ou commentaires, vous pouvez les publier plus bas.</p>
<h2>La situation actuelle: <span style="color: #3b5999;">Facebook</span></h2>
<p>Aujourd&#8217;hui Myspace est clairement en train de mourir. A ma connaissance les groupes l&#8217;utilisent toujours, au moins pour tenir leur agenda et avoir une page en ligne avec un minimum de customisation graphique mais le public a déserté.</p>
<p>En 2011 sur internet tout se passe sur Facebook, c&#8217;est pareil pour les évènements, la musique, les photos,&#8230; Tout migre sur facebook.</p>
<p>Je pense toujours que les évènements facebook ne sont pas aussi pratique qu&#8217;un bon site d&#8217;agenda. Par contre le système de RSVP, de like, de publication sur le mur, de commentaire et autres sont à exploiter.</p>
<h2>RFC pour la version 3 de Lascenenantaise</h2>
<p>En un mot: <span style="color: #bb1010;">agrégateur</span>. Pour l&#8217;instant je pense qu&#8217;une bonne idée serait de mettre en place une plateforme qui réunirait du contenu de facebook, de forums et de sites divers.</p>
<div class="note_box"> Cette partie du billet risque de changer au fur et à mesure, elle représente une liste d&#8217;idées et de réflexions. Elle devrait être regulièrement éditée.</div>
<h3>1. Le design</h3>
<p>Le design du nouveau site devra être considérablement allégé et simplifier. Je suis très fan de la structure et du design de <a href="http://peoplespress.org/">peoplespress.org</a>, le site sera probablement dans cette esprit&#8230; très proche même!</p>
<p>A priori on conservera les même couleurs, le design ne devrait pas être révolutionné. J&#8217;aimerais surtout un design simple à intégrer.</p>
<p style="text-align: center;"><a href="http://sigerr.org/wp-content/uploads/2011/07/peoplespress-example-inspiration.jpg"><img class="aligncenter size-full wp-image-170" title="peoplespress-example-inspiration" src="http://sigerr.org/wp-content/uploads/2011/07/peoplespress-example-inspiration.jpg" alt="" width="680" /></a></p>
<h3>2. La plateforme</h3>
<p>A priori je compte rester sous WordPress et probablement baser le site sur Thematic. J&#8217;utilise ce couple depuis plusieurs moi et je m&#8217;y suis pas mal habitué. WordPress est devenu extrêmement puissant au cours du temps et Thematic évite pas mal de travail ennuyant.</p>
<p>Ce soir j&#8217;ai jeté un oeil aux fonctions wp_insert_post() et add_post_meta() qui permettent de pouvoir poster un article à partir d&#8217;un script (cf le code suivant).</p>
<pre>

<div class="codecolorer-container php railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'../../../../wp-blog-header.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> add_one_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #666666; font-style: italic;">// Create post object</span><br />
&nbsp; <span style="color: #000088;">$my_post</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'post_title'</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Le titre de mon post'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'post_content'</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Ce post est créé à partir d une fonction'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'post_status'</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'publish'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'post_category'</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><br />
&nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; <span style="color: #666666; font-style: italic;">// Insert the post into the database</span><br />
&nbsp; <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> wp_insert_post<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$my_post</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; add_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'source'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://sigerr.org/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
add_one_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>

</pre>
<p>L&#8217;idée est de pouvoir créer quelques script qui généreraient des posts à partir de très peu d&#8217;information, comme une url facebook ou youtube.</p>
<h3>3. Les photos</h3>
<p>C&#8217;était déjà une idée pour la version 2, il faudra la mettre en place pour la version 3. Il s&#8217;agit de poster automatiquement quelques photos d&#8217;un photographe et ensuite rediriger vers le site origial.</p>
<p>L&#8217;intérêt pour nous est d&#8217;avoir plus de contenu et pour le photographe de gagner quelques visiteurs. A priori il est déjà connu, mais je pense des visiteurs moins réguliers et moins impliqués.</p>
<p>Exemple parfait: <a href="http://thrasher44.blogspot.com/">http://thrasher44.blogspot.com/</a></p>
<p>L&#8217;homme qui est à tout les concerts! On pourrait poster 5 ou 6 photos (automatiquement à partir du flux RSS) et ensuite renvoyer le visiteur son blog.</p>
<h3>4. Les vidéos</h3>
<p>Beaucoup de vidéos sont interessantes mais il n&#8217;est pas forcement facile de les retrouver. De simple post avec une video, un titre, des tags pourrait enrichir aussi le site. Il devrait etre possible de simplement créer un fichier texte avec toutes les URLs et ensuite récupérer le contenu depuis youtube.</p>
<p>On peut même créer un bonton dans le navigateur (un bookmark) qui post automatiquement la video que l&#8217;on regarde (à condition d&#8217;être sur youtube).</p>
<p>Avec le nouveau systeme de custom_post_type cela devrait pouvoir se faire plutôt bien.</p>
<h3>5. Annoncer ses dates, ses albums,&#8230;</h3>
<p>Cette nouvelle version devra offrir la possibilité à tous les visiteurs de pouvoir poster des actus, dates,&#8230;</p>
<p>Mais il faudra pouvoir modérer un minimum et bien sur ajouter un <em>disclaimer  </em>selon les cas.</p>
<h3>6. L&#8217;agenda</h3>
<p><img class="alignleft size-thumbnail wp-image-173" title="gCalWebApp" src="http://sigerr.org/wp-content/uploads/2011/07/gCalWebApp-150x150.png" alt="" width="150" height="150" /></p>
<p>C&#8217;est le coeur du site, il faut trouver une idée de génie pour un agenda le plus complet et le plus puissant possible. J&#8217;y réflechis.</p>
<p>Aujourd&#8217;hui j&#8217;ai testé la synchonisation des events facebook avec Google Calendar. Cela permet beaucoup de possibilités, par exemple la synchronisation avec d&#8217;autres logiciels mais surtout l&#8217;affichage est très clair. Dès que vous êtes invité à un évènement sur facebook, il apparait dans Gcal, donc attention aux spams aussi.</p>
<p><span style="text-decoration: underline;">Problème</span>: difficile de lier l&#8217;agenda à l&#8217;event sur le site pour plus de details&#8230; ou de pages vues.</p>
<p>Edit: Visiblement la synchronisation se contente de vous noter &#8220;<em>busy</em>&#8221; sans détailler les events.</p>
<p>Une possible piste avec une application facebook: <a href="https://www.facebook.com/apps/application.php?id=101709316537832">https://www.facebook.com/apps/application.php?id=101709316537832</a></p>
<div class="note_box"> Finalement la solution pourrait bien etre une application Chrome! Les évènement ne sont pas ajoutés automatiquement mais l&#8217;appli vous propose un bouton qui permet d&#8217;ajouter les infos à Google calendar simplement.</p>
<p>On aurait donc le tri + la simplicité</p>
<p>Lien: <a href="http://www.makeuseof.com/tag/easily-export-facebook-events-google-calendar-chrome/">http://www.makeuseof.com/tag/easily-export-facebook-events-google-calendar-chrome/</a></p>
<p></div>
<p>Ensuite il faudra integrer le calendar dans wordpress, idéalement il faudrait 2 vues. Une vue calendar classique et une vue en liste. Tout ca ne semble pas super compliqué avec ces quelques plugins:</p>
<ol>
<li>Magnigique plugin pour obtenir une liste ou bien une grille: <a href="http://wordpress.org/extend/plugins/google-calendar-events/">http://wordpress.org/extend/plugins/google-calendar-events/</a></li>
<li>Un peu le même genre: <a href="http://code.google.com/p/wpng-calendar/">http://code.google.com/p/wpng-calendar/</a></li>
<li>Personnaliser l&#8217;affichage du calendrier: <a href="http://wordpress.org/extend/plugins/google-calendar-weekly-timetable/">http://wordpress.org/extend/plugins/google-calendar-weekly-timetable/</a></li>
</ol>
<div>Le calendrier commence très franchement à pendre forme dans ma tête. L&#8217;utilisation de Google Calendra sera surement retenue.</div>
<h3>7. Les magasins</h3>
<p>Faire une page avec les shop interessants à nantes et afficher les flux rss.</p>
<p>Exemples:</p>
<ul>
<li><a href="http://rideall.blogspot.com/">http://rideall.blogspot.com/</a></li>
<li><a href="http://www.milkskate.com/index.php?option=com_myblog&amp;Itemid=61">http://www.milkskate.com/index.php?option=com_myblog&amp;Itemid=61</a> (pas de flux)</li>
<li><a href="http://ndjsk8shop.over-blog.com/">http://ndjsk8shop.over-blog.com/</a></li>
<li><a href="http://siroccosk8.blogspot.com/">http://siroccosk8.blogspot.com/</a></li>
<li><a href="http://www.myspace.com/rockagogovpc/blog">http://www.myspace.com/rockagogovpc/blog</a></li>
<li><a href="http://www.laboutik.fr/index.php">http://www.laboutik.fr/index.php</a> (pas de news :s)</li>
<li> ??</li>
</ul>
<div>
<div id="attachment_195" class="wp-caption aligncenter" style="width: 310px"><a href="http://sigerr.org/wp-content/uploads/2011/08/shateshop-nantes-lascenenantaise-draft.jpg"><img class="size-medium wp-image-195" title="shateshop nantes lascenenantaise draft" src="http://sigerr.org/wp-content/uploads/2011/08/shateshop-nantes-lascenenantaise-draft-300x237.jpg" alt="" width="300" height="237" /></a><p class="wp-caption-text">Cliquez pour agrandir le brouillon</p></div>
<h3>8. Login et commentaires</h3>
<p>Le système de commentaire de Thematic est plutôt puissant. Il faudra voir pour l&#8217;intégration d&#8217;un plugin du genre Discus.</p>
<p>Pour le login, utilisation de Facebook Connect ou Twitter Connect simplifiera l&#8217;inscription.</p>
</div>
<h2>Conclusion</h2>
<p>Bon voila en relisant tout ça je me dit que ca ne devrait pas être prêt avant Noël&#8230; et encore ! Ca promet beaucoup de boulot mais avec un fonctionnement plus automatique, on devrait finalement être largement gagnant.</p>
<p>Après quelques courtes recherche l&#8217;intégration facebook ne devrait pas être aussi poussé que prevu, trop complexe. <img src='http://www.sigerr.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>Ps: si vous aimez les petits LU, <a href="http://dustyburrito.blogspot.com/2009/08/lu-petit-beurre.html">passez par ici</a>.</p>
<div class="info_box">Adobe vient juste de publier son outils &#8220;Muse&#8221; pour créer des design poussés sans toucher au code, un peu à la Photoshop mais en générant du code. Ca semble être du code plutôt propre. Il faudra expérimenter!</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sigerr.org/french/un-avenir-pour-lascenenantaise-net-french/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Thematic: One Page Child theme</title>
		<link>http://www.sigerr.org/wordpress/wordpress-thematic-one-page-child-theme</link>
		<comments>http://www.sigerr.org/wordpress/wordpress-thematic-one-page-child-theme#comments</comments>
		<pubDate>Sat, 30 Jul 2011 17:17:14 +0000</pubDate>
		<dc:creator>Julien Bourdeau</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[parent/child]]></category>
		<category><![CDATA[project]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[thematic]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[_project]]></category>

		<guid isPermaLink="false">http://sigerr.org/?p=150</guid>
		<description><![CDATA[There is something I have really appreciated on web for years: one page website. One of the best example: http://lesscss.org/ Anyway, as I&#8217;m a big fan of Thematic, I thought that I could use Thematic to create easily this kind of website. So I wrote some lines and made a child theme. Also, you can easily [...]]]></description>
				<content:encoded><![CDATA[<p>There is something I have really appreciated on web for years: one page website. One of the best example: <a href="http://lesscss.org/">http://lesscss.org</a>/</p>
<p>Anyway, as I&#8217;m a big fan of Thematic, I thought that I could use Thematic to create easily this kind of website. So I wrote some lines and made a child theme. Also, you can easily use this child theme as a template page with your own child theme.<span id="more-150"></span></p>
<h2>Features</h2>
<p>Basically you will display on only one page, let&#8217;s call it &#8216;page 1&#8242;, every child page (subpage). Your page 1 is a wrapper that contains many page with a submenu. Each part is linked as an anchor using the slug. Therefore URLs are pretty friendly.</p>
<p>The menu is defined once and then printed everytime.</p>
<p><del>I still didn&#8217;t add some JS to make the page scroll up and down but I will&#8230; one day</del>. Now it&#8217;s done and its based on <a href="http://archive.plugins.jquery.com/project/ScrollTo">Ariel Flesler&#8217;s plugin</a>.</p>
<h2>Documentation</h2>
<p>If you want to use it on its own, you can download the files and add them in the themes folder. If you want to add it to your child theme you can follow these steps.</p>
<h3>The template page</h3>
<p>In your folder create a new php file called &#8216;onepage.php&#8217; and paste this code. The file name is important for the css rules (cf: thematic_body_class function).</p>
<pre>

<div class="codecolorer-container php railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #009933; font-style: italic;">/**<br />
*<br />
* Template Name: One Unique Page<br />
*<br />
**/</span><br />
<br />
&nbsp; <span style="color: #666666; font-style: italic;">// calling the header.php</span><br />
&nbsp; get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; <span style="color: #666666; font-style: italic;">// action hook for placing content above #container</span><br />
&nbsp; thematic_abovecontainer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> get_the_id<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; thmonepage_navigation<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Define the menu</span><br />
&nbsp; query_posts<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;post_type=page&amp;post_parent=<span style="color: #006699; font-weight: bold;">$id</span>&amp;orderby=menu_order&amp;order=ASC&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; <span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'childtheme_override_onepageloop'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; childtheme_override_onepageloop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$the_slug</span> <span style="color: #339933;">=</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;container&quot; class=&quot;container-<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> container-<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$the_slug</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$count</span><span style="color: #339933;">%</span><span style="color:#800080;">2</span><span style="color: #339933;">==</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>?<span style="color: #0000ff;">'even'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'odd'</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;a name=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$the_slug</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;&lt;/a&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> thematic_abovecontent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;content&quot;&gt;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> MY_MENU<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;div id=&quot;post-<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;h3&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h3&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;&lt;!-- #content --&gt;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> thematic_belowcontent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/div&gt;&lt;!-- #container --&gt;<br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #000088;">$count</span><span style="color: #339933;">++;</span><br />
&nbsp; <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; <span style="color: #b1b100;">else</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;em&gt;No content available&lt;/em&gt;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; wp_reset_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; <span style="color: #666666; font-style: italic;">// action hook for placing content below #container</span><br />
&nbsp; thematic_belowcontainer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; <span style="color: #666666; font-style: italic;">// calling footer.php</span><br />
&nbsp; get_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>

</pre>
<h3>The Style</h3>
<p>Add these following lines in your style.css file.</p>
<pre>

<div class="codecolorer-container css railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">/* =Page Templates<br />
-------------------------------------------------------------- */</span><br />
<br />
<span style="color: #808080; font-style: italic;">/*<br />
&nbsp; &nbsp; One Page template<br />
*/</span><br />
<span style="color: #6666ff;">.page-template-onepage-php</span> <span style="color: #cc00cc;">#main</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #6666ff;">.page-template-onepage-php</span> <span style="color: #cc00cc;">#container</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">100%</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #6666ff;">.page-template-onepage-php</span> <span style="color: #cc00cc;">#content</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">940px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #6666ff;">.page-template-onepage-php</span> <span style="color: #cc00cc;">#comments</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">940px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #6666ff;">.page-template-onepage-php</span> <span style="color: #cc00cc;">#comments</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">940px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #6666ff;">.page-template-onepage-php</span> h3 <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">24px</span><span style="color: #00AA00;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #6666ff;">.page-template-onepage-php</span> <span style="color: #cc00cc;">#container</span> <span style="color: #cc00cc;">#access</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">16px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #6666ff;">.even</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f5f5f5</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #6666ff;">.odd</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>

</pre>
<h3>The functions.php</h3>
<p>And finally add this simple function in you functions.php file.</p>
<div class="note_box">This piece of code has changed a bit since I added the JS scroll support. Nothing big.</div>
<pre>

<div class="codecolorer-container php railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> thmonepage_navigation<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000088;">$indexurl</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$content</span><span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;div id='access'&gt;&lt;div class='menu'&gt; <span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span> &lt;ul class='sf-menu sf-js-enabled'&gt; <span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; query_posts<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;post_type=page&amp;post_parent=<span style="color: #006699; font-weight: bold;">$id</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$post_id</span> <span style="color: #339933;">=</span> get_the_id<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$slug</span> <span style="color: #339933;">=</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$content</span><span style="color: #339933;">.=</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&lt;li class='page_item page_item_&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$post_id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;&lt;a href='#&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$slug</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$title</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/a&gt;&lt;/li&gt; <span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span><br />
&nbsp; wp_reset_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; <span style="color: #000088;">$content</span><span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/ul&gt; <span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span> &lt;/div&gt;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span>MY_MENU<span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>

</pre>
<h2>Miscellaneous</h2>
<h3>Remove Thematic menu</h3>
<p>If you want to use this page into a bigger website you will probably keep a main menu. To display this menu on everypage except these using this templage, ass these lines in your styles.css.</p>
<pre>

<div class="codecolorer-container css railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">/* Remove the main menu on this template only */</span><br />
<span style="color: #6666ff;">.page-template-onepage-php</span> <span style="color: #cc00cc;">#header</span> <span style="color: #cc00cc;">#access</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>

</pre>
<p>If you want to purely remove the access menu, add these lines in your functions.php</p>
<pre>

<div class="codecolorer-container php railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> thmonepage_remove_access<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; remove_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thematic_header'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'thematic_access'</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'thmonepage_remove_access'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>

</pre>
<h2>ChangeLog</h2>
<p><strong>0.2</strong></p>
<ul>
<li>Added JS to scroll</li>
<li>Corrected the page order (now in the menu order)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sigerr.org/wordpress/wordpress-thematic-one-page-child-theme/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A parent template page to display child page list and details</title>
		<link>http://www.sigerr.org/wordpress/a-parent-template-page-to-display-child-page-list-and-details</link>
		<comments>http://www.sigerr.org/wordpress/a-parent-template-page-to-display-child-page-list-and-details#comments</comments>
		<pubDate>Fri, 01 Apr 2011 12:56:31 +0000</pubDate>
		<dc:creator>Julien Bourdeau</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[parent/child]]></category>
		<category><![CDATA[wpdev]]></category>

		<guid isPermaLink="false">http://sigerr.org/?p=62</guid>
		<description><![CDATA[During this WordPress theme development (based on thematic), I was looking for how to create a nice parent page. Basically in the navigation menu there is a page &#8220;Projects&#8221; and each project is a subpage. But you have to create the &#8220;Projects&#8221; page content to describe what is this part (you also can redirect to the first [...]]]></description>
				<content:encoded><![CDATA[<p>During this WordPress theme development (based on thematic), I was looking for how to create a nice parent page. Basically in the navigation menu there is a page &#8220;Projects&#8221; and each project is a subpage. But you have to create the &#8220;Projects&#8221; page content to describe what is this part (you also can redirect to the first child page, but I dont like it).</p>
<p>Anyway, this function displays each child page title, link and a description. The description is stored in a custom field &#8220;desc&#8221; in each subpage.<span id="more-62"></span></p>
<h2>About</h2>
<p>This function is actually easy but could help you to save some time.</p>
<p>The function is based on <a href="http://codex.wordpress.org/Function_Reference/get_pages">get_pages()</a>. To make it works you need to create a page and some child page. In each child page create a custom field with the key &#8220;desc&#8221; and fill the value with a little description.</p>
<h2>Install</h2>
<p>Add this function is your functions.php.</p>
<pre>

<div class="codecolorer-container php railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
<span style="color: #666666; font-style: italic;">/*<br />
&nbsp;* &nbsp; Template Parent Page<br />
&nbsp;**************************************************/</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> sigerr_display_subpage_list<span style="color: #009900;">&#40;</span><span style="color: #000088;">$parentID</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #666666; font-style: italic;">//Get all the child page of the current page</span><br />
&nbsp; <span style="color: #000088;">$pages</span> <span style="color: #339933;">=</span> get_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'child_of='</span><span style="color: #339933;">.</span><span style="color: #000088;">$parentID</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;sort_column=post_date&amp;&amp;sort_order=asc&amp;echo=0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<br />
&nbsp; &nbsp; &lt;div id=&quot;childpagelist&quot; class=&quot;&quot;&gt;<br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; <span style="color: #666666; font-style: italic;">//Echo the list</span><br />
&nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pages</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$page</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;h2&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$link</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;See the entire page about <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/a&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/h2&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;desc&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$page</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;desc&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;No details available, let's check that page!&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &lt;p&gt;See: &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$link</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$link</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/p&gt;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &lt;/p&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
<br />
&nbsp; &nbsp; &lt;/div&gt;<br />
<br />
&nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>

</pre>
<p>This function is now available in your theme</p>
<h2>Create a Template Page</h2>
<p>Create a new template for wordpress page. If you dont know how, just copy your page.php file and rename it in &#8216;template-page-parent.php&#8217;.</p>
<p>Then add this at the very top of the file.</p>
<pre>

<div class="codecolorer-container php railscasts" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #009933; font-style: italic;">/**<br />
&nbsp;* Template Name: Parent<br />
&nbsp;*<br />
&nbsp;* This template display a list of each child page with details.<br />
&nbsp;* Details are stored in a custon field 'desc' in child pages<br />
&nbsp;*<br />
&nbsp;*/</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>

</pre>
<p>Then locate the piece of code &#8220;the_content()&#8221;. This function print the content of the post. You should probably print the list just after this function.</p>
<pre>&lt;?php display_subpage_list($post-&gt;ID) ?&gt;</pre>
<p>This function print the list into a div#childpagelist.</p>
<p>If you get any trouble, feel free to leave a comment. <img src='http://www.sigerr.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="info_box"> I rewrote this post as a <a href="http://sigerr.org/projects/wordpress-custom-template-for-parent-page">project</a>.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sigerr.org/wordpress/a-parent-template-page-to-display-child-page-list-and-details/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
