<?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>Mark Leong &#187; Web work</title>
	<atom:link href="http://www.markyleong.com/category/web-work/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.markyleong.com</link>
	<description>Christianity. Books. Computers. The web.</description>
	<lastBuildDate>Fri, 03 Sep 2010 14:20:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress hack: Force wp_list_pages() to print current_page_item class</title>
		<link>http://www.markyleong.com/wordpress-hack-force-wp_list_pages-to-print-current_page_item-class/</link>
		<comments>http://www.markyleong.com/wordpress-hack-force-wp_list_pages-to-print-current_page_item-class/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 09:26:15 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Web work]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.markyleong.com/?p=870</guid>
		<description><![CDATA[The wp_list_pages() function displays a list of WordPress pages as links and is often used to display navigation menus. When it prints the list of links, it adds a CSS class current_page_item to the list item tag of the current page. This allows custom styling to be applied to the link e.g. to highlight a [...]]]></description>
			<content:encoded><![CDATA[<p>The <code>wp_list_pages()</code> function displays a list of WordPress pages as links and is often used to display navigation menus. When it prints the list of links, it adds a CSS class <code>current_page_item</code> to the list item tag of the current page. This allows custom styling to be applied to the link e.g. to highlight a link to indicate the page that the visitor is on.</p>
<p><strong>The limitation with this is that it only works if you are viewing a page or an attachment, or are on the posts page (as set in Settings > Reading).</strong></p>
<p>I was working on an archive page for a custom taxonomy and wanted to have the <code>current_page_item</code> CSS class added to the list item of a particular link of my choice. After poking around a bit in the <code>wp_list_pages()</code> code listing, I discovered it’s possible to hack the <code>$wp_query</code> object to make <code>wp_list_pages()</code> do what I wanted it to. </p>
<p>Here’s how:</p>
<pre name="code" class="php">
// Get the ID of the link you want highlighted. Either:
// - hardcode it (as below)
// - or query the database to get it
$the_id = "1";

// Make a copy of the $wp_query object
$temp_query = clone $wp_query;

// Trick WordPress into thinking we're on a page with ID $the_id
$wp_query->is_page = 1;
$wp_query->queried_object_id = $the_id;

// Display pages
wp_list_pages("title_li=");

// Reset $wp_query
$wp_query = clone $temp_query;
</pre>
<p><strong>Notes:</strong></p>
<ul>
<li><code>$wp_query->is_page</code> needs to be set to <code>1</code> (true) because <code>wp_list_pages()</code> does not set a current page unless <code>is_page()</code> or <code>is_attachment()</code> or <code>$wp_query->is_posts_page</code> returns true.</li>
<li>If you only want this code to run when you are on certain page you can wrap it in an <code>if</code> statement that checks a WordPress <a href="http://codex.wordpress.org/Conditional_Tags">conditional tag</a>. In my case I only wanted to run this code when a taxonomy archive was being displayed so I used <code>is_tax()</code>.</li>
<li>See <a href="http://www.jenst.se/2008/03/17/wordpress-get-id-by-post-or-page-name/">http://www.jenst.se/2008/03/17/wordpress-get-id-by-post-or-page-name/</a> on how to query the database by post/page name to get an ID.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.markyleong.com/wordpress-hack-force-wp_list_pages-to-print-current_page_item-class/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Website launched: Riverside Church</title>
		<link>http://www.markyleong.com/website-launched-riverside-church/</link>
		<comments>http://www.markyleong.com/website-launched-riverside-church/#comments</comments>
		<pubDate>Thu, 08 Jul 2010 21:51:51 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Web work]]></category>
		<category><![CDATA[website-launch]]></category>

		<guid isPermaLink="false">http://www.markyleong.com/?p=869</guid>
		<description><![CDATA[Over the last few months, I&#8217;ve been working on a redesign of the website of my church in Birmingham, Riverside Church. Today the new website went live! Home page: Normal content page: Please let me know what you think by leaving a comment, thanks!]]></description>
			<content:encoded><![CDATA[<p>Over the last few months, I&#8217;ve been working on a redesign of the website of my church in Birmingham, <a href="http://www.riverside-church.org.uk/">Riverside Church</a>. Today the new website went live!</p>
<p><strong>Home page:</strong></p>
<p><a href="http://www.riverside-church.org.uk/"><img src="http://www.markyleong.com/wp-content/uploads/2010/07/riverside_church_01_thumb.png" alt="" width="480" height="361" class="alignnone size-full wp-image-867" /></a></p>
<p><strong>Normal content page:</strong></p>
<p><a href="http://www.riverside-church.org.uk/about/about-riverside/"><img src="http://www.markyleong.com/wp-content/uploads/2010/07/riverside_church_02_thumb.png" alt="" width="480" height="361" class="alignnone size-full wp-image-868" /></a></p>
<p>Please let me know what you think by leaving a comment, thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markyleong.com/website-launched-riverside-church/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set WordPress custom post types order in admin</title>
		<link>http://www.markyleong.com/set-wordpress-custom-post-types-order-in-admin/</link>
		<comments>http://www.markyleong.com/set-wordpress-custom-post-types-order-in-admin/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 16:51:14 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Web work]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.markyleong.com/?p=864</guid>
		<description><![CDATA[One of the long-awaited new features of WordPress 3.0 is custom post types. By default, custom posts with the post capability_type (as opposed to page, attachment, revision, or nav-menu-item) are listed newest to oldest in the WordPress backend. This makes sense if these are blog posts, but if they are some other content type (such [...]]]></description>
			<content:encoded><![CDATA[<p>One of the long-awaited new features of WordPress 3.0 is <a href="http://codex.wordpress.org/Custom_Post_Types">custom post types</a>. </p>
<p>By default, custom posts with the <em>post</em> <a href="http://codex.wordpress.org/Function_Reference/register_post_type">capability_type</a> (as opposed to page, attachment, revision, or nav-menu-item) are listed newest to oldest in the WordPress backend. This makes sense if these are blog posts, but if they are some other content type (such as quotes, movies, books or contacts) it is often desirable to have them listed alphabetically.</p>
<p>To achieve this, add the following code to your <strong>functions.php</strong> file, replacing <strong>POST_TYPE</strong> (line 7) with the name of the post type that you want to have listed alphabetically.</p>
<pre name="code" class="php">
function set_custom_post_types_admin_order($wp_query) {
  if (is_admin()) {

    // Get the post type from the query
    $post_type = $wp_query->query['post_type'];

    if ( $post_type == 'POST_TYPE') {

      // 'orderby' value can be any column name
      $wp_query->set('orderby', 'title');

      // 'order' value can be ASC or DESC
      $wp_query->set('order', 'ASC');
    }
  }
}
add_filter('pre_get_posts', 'set_custom_post_types_admin_order');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.markyleong.com/set-wordpress-custom-post-types-order-in-admin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>New website launched: Kingsbridge Project</title>
		<link>http://www.markyleong.com/new-website-launched-kingsbridge-project/</link>
		<comments>http://www.markyleong.com/new-website-launched-kingsbridge-project/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 14:46:09 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Web work]]></category>
		<category><![CDATA[website-launch]]></category>

		<guid isPermaLink="false">http://markyleong.dreamhosters.com/?p=860</guid>
		<description><![CDATA[This week saw the launch of the Kingsbridge Project website that I&#8217;ve been working on with some friends from church. The Kingsbridge Project is a consortium of faith groups, social enterprises, sports bodies and public bodies dedicated to bringing together communities in South Birmingham through sport and community activity. The initiative is currently in its [...]]]></description>
			<content:encoded><![CDATA[<p>This week saw the launch of the <a href="http://www.kingsbridge-project.org/">Kingsbridge Project</a> website that I&#8217;ve been working on with some friends from church.</p>
<p><a href="http://www.kingsbridge-project.org/"><img src="/wp-content/uploads/2010/06/kingsbridge_project_thumb.png" alt="Kingsbridge Project" title="Kingsbridge Project" width="480" height="360" class="aligncenter size-full wp-image-862" /></a></p>
<p>The Kingsbridge Project is a consortium of faith groups, social enterprises, sports bodies and public bodies dedicated to bringing together communities in South Birmingham through sport and community activity. The initiative is currently in its early stages and the website is meant to serve its current needs of establishing a web presence and providing publicity. As a result I decided that instead of creating a custom design, I would use &#8216;PersonalPress&#8217;, a premium WordPress theme <a href="http://www.elegantthemes.com/">Elegant Themes</a>, so that I could get site off the ground as quickly as possible.</p>
<p>Please let me know what you think by leaving a comment, thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markyleong.com/new-website-launched-kingsbridge-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New website launched: The Malaysian Gym Directory</title>
		<link>http://www.markyleong.com/new-website-launched-the-malaysian-gym-directory/</link>
		<comments>http://www.markyleong.com/new-website-launched-the-malaysian-gym-directory/#comments</comments>
		<pubDate>Sat, 22 May 2010 09:10:53 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Web work]]></category>
		<category><![CDATA[website-launch]]></category>

		<guid isPermaLink="false">http://www.markyleong.com/?p=850</guid>
		<description><![CDATA[A few weeks ago I was searching online for gyms in Malaysia and found that there weren&#8217;t any dedicated gym directory websites. This got me thinking and the idea of setting up an online Malaysian gym directory was born. Yesterday the website went live &#8211; you can check it out here: http://www.malaysian-gyms.com. Please let me [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I was searching online for gyms in Malaysia and found that there weren&#8217;t any dedicated gym directory websites. This got me thinking and the idea of setting up an online Malaysian gym directory was born.</p>
<p>Yesterday the website went live &#8211; you can check it out here: <a href="http://www.malaysian-gyms.com">http://www.malaysian-gyms.com</a>.</p>
<p><a href="http://www.malaysian-gyms.com"><img src="/wp-content/uploads/2010/05/malaysian_gym_directory_thumb.png" alt="The Malaysian Gym Directory" title="The Malaysian Gym Directory" width="480" height="360" class="aligncenter size-full wp-image-858" /></a></p>
<p>Please let me know what you think by leaving a comment, thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.markyleong.com/new-website-launched-the-malaysian-gym-directory/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>New CU website launched</title>
		<link>http://www.markyleong.com/new-cu-website-launched/</link>
		<comments>http://www.markyleong.com/new-cu-website-launched/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 16:39:35 +0000</pubDate>
		<dc:creator>Mark Leong</dc:creator>
				<category><![CDATA[Web work]]></category>
		<category><![CDATA[website-launch]]></category>

		<guid isPermaLink="false">http://www.markyleong.com/?p=281</guid>
		<description><![CDATA[Jonathan Bennett and I have been working on a new website for the Christian Union at the University of Birmingham over the summer. The website went live yesterday &#8211; you can check it out here: http://www.ubcu.org.uk/. Feedback is welcome]]></description>
			<content:encoded><![CDATA[<p><a href="http://twitter.com/thebanjotennant">Jonathan Bennett</a> and I have been working on a new website for the Christian Union at the University of Birmingham over the summer. The website went live yesterday &#8211; you can check it out here: <a href="http://www.ubcu.org.uk/">http://www.ubcu.org.uk/</a>.</p>
<p><a href="http://www.ubcu.org.uk/"><img src="/wp-content/uploads/2009/09/ubcu-screenshot.png" alt="ubcu-screenshot" title="ubcu-screenshot" width="550" height="296" class="aligncenter size-full wp-image-282" /></a></p>
<p>Feedback is welcome <img src='http://www.markyleong.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.markyleong.com/new-cu-website-launched/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
