<?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>Zeo &#187; gallery</title>
	<atom:link href="http://zeo.unic.net.my/tag/gallery/feed/" rel="self" type="application/rss+xml" />
	<link>http://zeo.unic.net.my</link>
	<description>Safirul Alredha on web, WordPress, K2, Apple, ...</description>
	<lastBuildDate>Wed, 09 Jun 2010 15:34:46 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPress [gallery]: Force x Number of Columns</title>
		<link>http://zeo.unic.net.my/wordpress-gallery-force-x-number-of-columns/</link>
		<comments>http://zeo.unic.net.my/wordpress-gallery-force-x-number-of-columns/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 10:00:31 +0000</pubDate>
		<dc:creator>Zeo</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[columns]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[shortcode]]></category>

		<guid isPermaLink="false">http://zeo.unic.net.my/?p=1028</guid>
		<description><![CDATA[Does anyone know the easiest way for WordPress &#91;gallery&#93; to force x number of columns display without tampering the core or manually set the columns value to the shortcode?
I could only figure out 2 possible ways: 

function / code duplication
Regular expression

If you use &#91;gallery&#93; shortcode without setting the columns value, the default is set to [...]]]></description>
			<content:encoded><![CDATA[<p>Does anyone know the easiest way for <a rel="nofollow" href="http://codex.wordpress.org/Gallery_Shortcode">WordPress <code>&#91;gallery&#93;</code></a> to force <code>x</code> number of columns display without tampering the core or manually set the columns value to the shortcode?</p>
<p>I could only figure out 2 possible ways: </p>
<ol>
<li>function / code duplication</li>
<li>Regular expression</li>
</ol>
<p>If you use <code>&#91;gallery&#93;</code> shortcode without setting the columns value, the default is set to 3. Some WordPress theme can either fit 3 or more column per row or less. Below is an example to force <code>&#91;gallery&#93;</code> columns to 2 to any post or page that uses <code>&#91;gallery&#93;</code> shortcode:</p>
<pre>
function gallery_columns($content){
	$columns = 2;
	$pattern = array(
		'/(\&#91;gallery(.*?)columns="(&#91;0-9&#93;)"(.*?)\&#93;)/ie',
		'/(\&#91;gallery\&#93;)/ie',
		'/(\&#91;gallery(.*?)\&#93;)/ie'
	);
	$replace = 'stripslashes(strstr("\1", "columns=\"$columns\"") ? "\1" : "&#91;gallery \2 \4 columns=\"$columns\"&#93;")';

	return preg_replace($pattern, $replace, $content);
}

add_filter('the_content', 'gallery_columns');
</pre>
<p><code>$columns</code> can be set to any numeric value. If <code>&#91;gallery&#93;</code> columns is set to 0, no row breaks will be included. </p>
<p>There are probably some hidden drawbacks to the method above. Feel free to share if you have any other solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://zeo.unic.net.my/wordpress-gallery-force-x-number-of-columns/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Remove WordPress [gallery] shortcode embedded CSS</title>
		<link>http://zeo.unic.net.my/remove-wordpress-gallery-shortcode-embedded-css/</link>
		<comments>http://zeo.unic.net.my/remove-wordpress-gallery-shortcode-embedded-css/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 06:26:40 +0000</pubDate>
		<dc:creator>Zeo</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[shortcode]]></category>

		<guid isPermaLink="false">http://zeo.unic.net.my/?p=954</guid>
		<description><![CDATA[Dump this code anywhere in Theme&#8217;s template functions.php file (For example, functions.php file for a Theme named &#8220;default&#8221; would probably reside in the directory wp-content/themes/default/functions.php):

add_filter('gallery_style',
	create_function(
		'$css',
		'return preg_replace("#&#60;style type=\'text/css\'&#62;(.*?)&#60;/style&#62;#s", "", $css);'
		)
	);

And these are the classes for your stylesheet:

.gallery {}
.gallery-item {}
.gallery-icon {}
.gallery-caption {}

]]></description>
			<content:encoded><![CDATA[<p>Dump this code anywhere in Theme&#8217;s template <a rel="nofollow" href="http://codex.wordpress.org/Theme_Development#Functions_File"><tt>functions.php</tt></a> file (For example, <tt>functions.php</tt> file for a Theme named &#8220;default&#8221; would probably reside in the directory <tt>wp-content/themes/default/functions.php</tt>):</p>
<pre>
add_filter('gallery_style',
	create_function(
		'$css',
		'return preg_replace("#&lt;style type=\'text/css\'&gt;(.*?)&lt;/style&gt;#s", "", $css);'
		)
	);
</pre>
<p>And these are the classes for your stylesheet:</p>
<pre>
.gallery {}
.gallery-item {}
.gallery-icon {}
.gallery-caption {}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://zeo.unic.net.my/remove-wordpress-gallery-shortcode-embedded-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
