<?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/"
		xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>stefanomavilio.comstefanomavilio.com - digital strategist</title>
	<atom:link href="http://stefanomavilio.com/feed" rel="self" type="application/rss+xml" />
	<link>http://stefanomavilio.com</link>
	<description>digital strategist</description>
	<lastBuildDate>Sat, 19 May 2012 16:23:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<copyright>Copyright &#xA9; stefanomavilio.com 2011 </copyright>
	<managingEditor>stefano@mavilio.com (stefanomavilio.com)</managingEditor>
	<webMaster>stefano@mavilio.com (stefanomavilio.com)</webMaster>
	<image>
		<url>http://stefanomavilio.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
		<title>stefanomavilio.com</title>
		<link>http://stefanomavilio.com</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle></itunes:subtitle>
	<itunes:summary>digital strategis</itunes:summary>
	<itunes:keywords></itunes:keywords>
	<itunes:category text="Society &#38; Culture" />
	<itunes:author>stefanomavilio.com</itunes:author>
	<itunes:owner>
		<itunes:name>stefanomavilio.com</itunes:name>
		<itunes:email>stefano@mavilio.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://stefanomavilio.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<item>
		<title>morton valence &#8211; &#8220;Funny, Peculiar&#8221; lyrics</title>
		<link>http://stefanomavilio.com/morton-valence-funny-peculiar-lyrics.html</link>
		<comments>http://stefanomavilio.com/morton-valence-funny-peculiar-lyrics.html#comments</comments>
		<pubDate>Wed, 16 May 2012 21:26:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[funny peculiar]]></category>
		<category><![CDATA[lyrics]]></category>
		<category><![CDATA[morton valence]]></category>

		<guid isPermaLink="false">http://stefanomavilio.com/?p=347</guid>
		<description><![CDATA[we like to boogie all night dancing feel the world spinning around wow!! everything is so funky everyone looks so funny funny peculiar jerking about and dancing singing hallelujah!! people are funny they’ll say that everything’s cool they’ll make you laugh? then they’ll?disappoint you Something&#8217;s are funny Funny peculiar  Don&#8217;t know what it is You [...]]]></description>
			<content:encoded><![CDATA[<p>we like to boogie<br />
all night dancing<br />
feel the world spinning around<br />
wow!!<br />
everything is so funky</p>
<p>everyone looks so funny<br />
funny peculiar<br />
jerking about and dancing<br />
singing<br />
hallelujah!!</p>
<p>people are funny<br />
they’ll say that everything’s cool<br />
they’ll make you laugh?<br />
then they’ll?disappoint you</p>
<p>Something&#8217;s are funny<br />
Funny peculiar <br />
Don&#8217;t know what it is<br />
You don&#8217;t either</p>
<p>Where ever we go <br />
The grass just gets greener<br />
But we both know <br />
That it won&#8217;t last forever</p>
<p>People are funny <br />
Funny peculiar <br />
Fussing around<br />
Making plans for the future</p>
<p>I never wanted your honesty <br />
I just want your electricity<br />
Let it rain down over me<br />
Let it reign all over me</p>
]]></content:encoded>
			<wfw:commentRss>http://stefanomavilio.com/morton-valence-funny-peculiar-lyrics.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
			<enclosure url="http://www.youtube.com/watch?v=IjdC07setLs" length="1" type="application/unknown" />
		<itunes:duration>0:00:01</itunes:duration>
		<itunes:subtitle>we like to boogie
all night dancing
feel the world spinning around
wow!!
everything is so funky
everyone looks so funny
funny peculiar
jerking about and dancing
singing
hallelujah!!
people are funny
they’ll say that everything’s cool
they’ll make yo[...]</itunes:subtitle>
		<itunes:summary>we like to boogie
all night dancing
feel the world spinning around
wow!!
everything is so funky
everyone looks so funny
funny peculiar
jerking about and dancing
singing
hallelujah!!
people are funny
they’ll say that everything’s cool
they’ll make you laugh?
then they’ll?disappoint you
Something&#8217;s are funny
Funny peculiar 
Don&#8217;t know what it is
You don&#8217;t either
Where ever we go 
The grass just gets greener
But we both know 
That it won&#8217;t last forever
People are funny 
Funny peculiar 
Fussing around
Making plans for the future
I never wanted your honesty 
I just want your electricity
Let it rain down over me
Let it reign all over me</itunes:summary>
		<itunes:keywords>blog</itunes:keywords>
		<itunes:author>stefano@mavilio.com</itunes:author>
		<itunes:explicit>no</itunes:explicit>
		<itunes:block>no</itunes:block>
	</item>
		<item>
		<title>#144 – Table ‘./wp_posts’ is marked as crashed and last (automatic?) repair failed</title>
		<link>http://stefanomavilio.com/144-table-wp_posts-is-marked-as-crashed-and-last-automatic-repair-failed.html</link>
		<comments>http://stefanomavilio.com/144-table-wp_posts-is-marked-as-crashed-and-last-automatic-repair-failed.html#comments</comments>
		<pubDate>Thu, 26 Apr 2012 10:12:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://stefanomavilio.com/?p=342</guid>
		<description><![CDATA[Repairing a Crashed Table in phpMyAdmin I had a nasty surprise for me tonight when I realized none of my posts were available on my blog (the one you’re looking at now!). I could log into WordPress and see everything but my posts showed a count of zero (scary!). My first thought was to restore [...]]]></description>
			<content:encoded><![CDATA[<p>Repairing a Crashed Table in phpMyAdmin</p>
<p>I had a nasty surprise for me tonight when I realized none of my posts were available on my blog (the one you’re looking at now!). I could log into WordPress and see everything but my posts showed a count of zero (scary!). My first thought was to restore my latest backup only to realize my backup didn’t run this week. I did have the backup from last week so I logged into phpMyAdmin and this is where I found the actual problem. When I clicked on the wp_posts table, I received the following error:<br />
#144 – Table ‘./wp_posts’ is marked as crashed and last (automatic?) repair failed<br />
By no means am I a mysql expert. I’m still not sure why this even happened. However, this was actually not very difficult to correct in my case (once I found the cause and a few mysql forums) and I wanted to share the steps I went through to correct this:<br />
1. Sign into your phpMyAdmin account<br />
2. Click on your database name on the left<br />
3. Then click on SQL in the tabs on the top<br />
4. In the query box enter: repair table wp_posts and then click Go. (note: you’ll need to replace wp_posts with whatever table you are having an issue with if it’s not this table)</p>
]]></content:encoded>
			<wfw:commentRss>http://stefanomavilio.com/144-table-wp_posts-is-marked-as-crashed-and-last-automatic-repair-failed.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>giro aereo di sicilia 1955</title>
		<link>http://stefanomavilio.com/giro-aereo-di-sicilia-1955.html</link>
		<comments>http://stefanomavilio.com/giro-aereo-di-sicilia-1955.html#comments</comments>
		<pubDate>Sat, 18 Feb 2012 16:32:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://stefanomavilio.com/?p=339</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[]]></content:encoded>
			<wfw:commentRss>http://stefanomavilio.com/giro-aereo-di-sicilia-1955.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
			<enclosure url="mms://151.1.148.222/WMedia/300/MpegI300/I142005.wmv" length="1" type="video/wmv" />
		<itunes:duration>0:00:01</itunes:duration>
		<itunes:subtitle>giro aereo di sicilia 1955</itunes:subtitle>
		<itunes:keywords>blog</itunes:keywords>
		<itunes:author>stefano@mavilio.com</itunes:author>
		<itunes:explicit>no</itunes:explicit>
		<itunes:block>no</itunes:block>
	</item>
		<item>
		<title>the vespa m98</title>
		<link>http://stefanomavilio.com/the-vespa-m98.html</link>
		<comments>http://stefanomavilio.com/the-vespa-m98.html#comments</comments>
		<pubDate>Sun, 12 Feb 2012 19:56:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://stefanomavilio.com/?p=334</guid>
		<description><![CDATA[such a lovely modern design. italian 40&#8242;s]]></description>
			<content:encoded><![CDATA[<p>such a lovely modern design. italian 40&#8242;s<br />
<img class="alignnone size-full wp-image-335" title="vespa98corsa" src="http://stefanomavilio.com/wp-content/uploads/2012/02/vespa98corsa.jpg" alt="" width="800" height="600" /></p>
]]></content:encoded>
			<wfw:commentRss>http://stefanomavilio.com/the-vespa-m98.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpress-3-1-advanced-taxonomy-queries</title>
		<link>http://stefanomavilio.com/wordpress-3-1-advanced-taxonomy-queries.html</link>
		<comments>http://stefanomavilio.com/wordpress-3-1-advanced-taxonomy-queries.html#comments</comments>
		<pubDate>Wed, 11 Jan 2012 12:41:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://stefanomavilio.com/?p=268</guid>
		<description><![CDATA[http://ottopress.com/2010/wordpress-3-1-advanced-taxonomy-queries/ One of the new things in 3.1 that hasn’t got a lot of discussion yet is the new Advanced Taxonomy Queries mechanism. At the moment, this is still being actively developed, but the basic structure is finalized enough to give at least a semi-coherent explanation on how to use it. Since 3.1 is now [...]]]></description>
			<content:encoded><![CDATA[<p>http://ottopress.com/2010/wordpress-3-1-advanced-taxonomy-queries/</p>
<p>One of the new things in 3.1 that hasn’t got a lot of discussion yet is the new <a href="http://core.trac.wordpress.org/changeset/16555">Advanced Taxonomy Queries</a> mechanism. At the moment, this is still being actively developed, but the basic structure is finalized enough to give at least a semi-coherent explanation on how to use it. Since 3.1 is now going into beta, it’s unlikely to change much.</p>
<p>&nbsp;</p>
<h3>What’s a Query?</h3>
<p>In WordPress land, a “query” is anything that gets Posts. There’s a lot of ways to do this.</p>
<ul>
<li>You can use <a href="http://codex.wordpress.org/Function_Reference/query_posts">query_posts</a> to modify the main query of the page being displayed.</li>
<li>You can create a new <a href="http://codex.wordpress.org/Function_Reference/WP_Query">WP_Query</a>, to get some set of posts to display in its own custom Loop.</li>
<li>You can do a <a href="http://codex.wordpress.org/Template_Tags/get_posts">get_posts</a> to get some limited set of posts for display in some special way.</li>
</ul>
<p>Regardless of the method, you have to pass parameters to it in order to specify which posts you want. If you’ve used this at all before, then you’ve used parameters like cat=123, or tag=example, or category_name=bob and so forth. When custom taxonomies were developed, you were eventually able to specify things like taxonomy=foo and term=bar and so on.</p>
<h3>Querying for Posts</h3>
<p>The problem with these is that people sometimes want to specify more than one of these parameters, and not all parameters worked well together. Things like cat=a and tag=b, or cat=a and tag is not b, and so forth. This is because cat and tag are both forms of taxonomies, and the code didn’t handle that well. Sure, some of it worked, for specific cases, but those were mostly there by accident rather than by design. In other words, those cases worked because the system just happened to get it right for that particular instance.</p>
<p>Well, all these old methods still work, but they have been made into a more comprehensive system of generically specifying arbitrary taxonomies to match against. When you specify cat=123, it’ll actually be converting it to this new method internally.</p>
<h3>Query Strings are for Suckers</h3>
<p>One side effect of this new system is that it doesn’t really work with query strings very well. It can be done, but it’s a lot easier and more sensible if you just start getting into the array method of doing things instead. What’s the array method? I’ll explain:</p>
<p>Imagine you used to have a query that looked like this:</p>
<div id="highlighter_363510">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>query_posts(</code><code>'cat=123&amp;author=456'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>A simple query, really. The problem with it is that WordPress has to parse that query before it can use it. But there is another way to write that query as well:</p>
<div id="highlighter_356003">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>query_posts(</code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>  </code><code>'cat'</code> <code>=&gt; 123,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>  </code><code>'author'</code> <code>=&gt; 456,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>) );</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Essentially, you separate out each individual item into its own element in an array. This actually saves you some time in the query because it doesn’t have to parse it (there’s very little savings though).</p>
<p>The advantage of this is that you can build your arrays using any method of array handling you like. Here’s another way to do it:</p>
<div id="highlighter_855325">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>$myquery</code><code>[</code><code>'cat'</code><code>] = 123;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>$myquery</code><code>[</code><code>'author'</code><code>] = 456;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>query_posts(</code><code>$myquery</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Simple, no? But what if you have to deal with the $query_string? The <a href="http://codex.wordpress.org/Function_Reference/query_posts#Usage_Note">$query_string</a> is that old variable that is built by WordPress. It comes from the “default” query for whatever page you happen to be on. One of the main uses for it was to deal with “paging”. A common method of doing it was like this:</p>
<div id="highlighter_37920">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>query_posts(</code><code>$query_string</code> <code>. </code><code>'&amp;cat=123&amp;author=456'</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>If you use arrays, you have to deal with that yourself a bit. There’s a couple of possible ways to do it. The easiest is probably to just parse the query string yourself, then modify the result as you see fit. For example:</p>
<div id="highlighter_698410">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>$myquery</code> <code>= wp_parse_args(</code><code>$query_string</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>$myquery</code><code>[</code><code>'cat'</code><code>] = 123;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>$myquery</code><code>[</code><code>'author'</code><code>] = 456;</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>query_posts(</code><code>$myquery</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>I started out with the $query_string, used wp_parse_args to turn it into an array, then overwrote the bits I wanted to change and performed the query. This is a handy technique I’m sure a lot of people will end up using.</p>
<h3>On to Advanced Taxonomies</h3>
<p>Advanced Taxonomy queries use a new parameter to the query functions called “tax_query”. The tax_query is an array of arrays, with each array describing what you want it to match on.</p>
<p>Let’s lead by example. We want to get everything in the category of “foo” AND a tag of “bar”. Here’s our query:</p>
<div id="highlighter_583554">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>$myquery</code><code>[</code><code>'tax_query'</code><code>] = </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>        </code><code>'taxonomy'</code> <code>=&gt; </code><code>'category'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>        </code><code>'terms'</code> <code>=&gt; </code><code>array</code><code>(</code><code>'foo'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>        </code><code>'field'</code> <code>=&gt; </code><code>'slug'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>    </code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>    </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>        </code><code>'taxonomy'</code> <code>=&gt; </code><code>'post_tag'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code>        </code><code>'terms'</code> <code>=&gt; </code><code>array</code><code>(</code><code>'bar'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>        </code><code>'field'</code> <code>=&gt; </code><code>'slug'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>    </code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>query_posts(</code><code>$myquery</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>Here we’ve specified two arrays, each of which describes the taxonomy and terms we want to match it against. It’ll match against both of them, and only return the results where both are true.</p>
<p>There’s two things of note here:</p>
<p>First is that the “field” is the particular field we want to match. In this case, we have the slugs we want, so we used “slug”. You could also use “term_id” if you had the ID numbers of the terms you wanted.</p>
<p>Second is that the “terms” is an array in itself. It doesn’t actually have to be, for this case, as we only have one term in each, but I did it this way to illustrate that we can match against multiple terms for each taxonomy. If I used array(‘bar1?,’bar2?) for the post_tag taxonomy, then I’d get anything with a category of foo AND a tag of bar1 OR bar2.</p>
<p>And that second item illustrates an important point as well. The matches here are actually done using the “IN” operator. So the result is always equivalent to an “include” when using multiple terms in a single taxonomy. We can actually change that to an “exclude”, however, using the “operator” parameter:</p>
<div id="highlighter_228822">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>$myquery</code><code>[</code><code>'tax_query'</code><code>] = </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>        </code><code>'taxonomy'</code> <code>=&gt; </code><code>'category'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>        </code><code>'terms'</code> <code>=&gt; </code><code>array</code><code>(</code><code>'foo'</code><code>, </code><code>'bar'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>        </code><code>'field'</code> <code>=&gt; </code><code>'slug'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>        </code><code>'operator'</code> <code>=&gt; </code><code>'NOT IN'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>    </code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code>query_posts(</code><code>$myquery</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>The above query will get any post that is NOT in either the “foo” or “bar” category.</p>
<p>But what about terms across multiple taxonomies? So far we’ve only seen those being AND’d together. Well, the “relation” parameter takes care of that:</p>
<div id="highlighter_490422">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>$myquery</code><code>[</code><code>'tax_query'</code><code>] = </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>    </code><code>'relation'</code> <code>=&gt; </code><code>'OR'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>        </code><code>'taxonomy'</code> <code>=&gt; </code><code>'category'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>        </code><code>'terms'</code> <code>=&gt; </code><code>array</code><code>(</code><code>'foo'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>        </code><code>'field'</code> <code>=&gt; </code><code>'slug'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>    </code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>    </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code>        </code><code>'taxonomy'</code> <code>=&gt; </code><code>'post_tag'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>        </code><code>'terms'</code> <code>=&gt; </code><code>array</code><code>(</code><code>'bar'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>        </code><code>'field'</code> <code>=&gt; </code><code>'slug'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>    </code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>query_posts(</code><code>$myquery</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>This gets us anything with a category of foo OR a tag of bar. Note that the relation is global to the query, so it appears outside the arrays in the tax_query, but still in the tax_query array itself. For clarity, I recommend always putting it first.</p>
<h3>Useful Gallery Example</h3>
<p>By combining these in different ways, you can make complex queries. What’s more, you can use it with any taxonomy you like. Here’s one I recently used:</p>
<div id="highlighter_837034">
<div>
<div>
<table>
<tbody>
<tr>
<td><code>1</code></td>
<td><code>$galleryquery</code> <code>= wp_parse_args(</code><code>$query_string</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>2</code></td>
<td><code>$galleryquery</code><code>[</code><code>'tax_query'</code><code>] = </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>3</code></td>
<td><code>    </code><code>'tax_query'</code> <code>=&gt; </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>4</code></td>
<td><code>        </code><code>'relation'</code> <code>=&gt; </code><code>'OR'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>5</code></td>
<td><code>        </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>6</code></td>
<td><code>            </code><code>'taxonomy'</code> <code>=&gt; </code><code>'post_format'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>7</code></td>
<td><code>            </code><code>'terms'</code> <code>=&gt; </code><code>array</code><code>(</code><code>'post-format-gallery'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>8</code></td>
<td><code>            </code><code>'field'</code> <code>=&gt; </code><code>'slug'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>9</code></td>
<td><code>        </code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>10</code></td>
<td><code>        </code><code>array</code><code>(</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>11</code></td>
<td><code>            </code><code>'taxonomy'</code> <code>=&gt; </code><code>'category'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>12</code></td>
<td><code>            </code><code>'terms'</code> <code>=&gt; </code><code>array</code><code>(</code><code>'gallery'</code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>13</code></td>
<td><code>            </code><code>'field'</code> <code>=&gt; </code><code>'slug'</code><code>,</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>14</code></td>
<td><code>        </code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>15</code></td>
<td><code>    </code><code>),</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>16</code></td>
<td><code>) );</code></td>
</tr>
</tbody>
</table>
</div>
<div>
<table>
<tbody>
<tr>
<td><code>17</code></td>
<td><code>query_posts(</code><code>$galleryquery</code><code>);</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<p>This gets any posts in either the gallery category OR that have a gallery post-format. Handy for making a gallery page template. I used the wp_parse_args($query_string) trick to make it able to handle paging properly, among other things.</p>
<h3>Speed Concerns</h3>
<p>Advanced taxonomy queries are cool, but be aware that complex queries are going to be slower. Not much slower, since the code does attempt to do things smartly, but each taxonomy you add is the equivalent of adding a JOIN. While the relevant tables are indexed, joins are still slower than non-joins. So it won’t always be a good idea to build out highly complex queries.</p>
<p>Still, it’s better than rolling your own complicated code to get a lot of things you don’t need and then parsing them out yourself. A whole lot easier too.</p>
]]></content:encoded>
			<wfw:commentRss>http://stefanomavilio.com/wordpress-3-1-advanced-taxonomy-queries.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wordpress custom fields and taxonomy</title>
		<link>http://stefanomavilio.com/wordpress-custom-fields-and-taxonomy.html</link>
		<comments>http://stefanomavilio.com/wordpress-custom-fields-and-taxonomy.html#comments</comments>
		<pubDate>Wed, 11 Jan 2012 12:34:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://stefanomavilio.com/?p=265</guid>
		<description><![CDATA[http://netinial.com/blog/wordpress/get_post_meta_multiple-pagination-and-ordering WordPress get_post_meta_multiple, Pagination and Ordering. Dealing with wordpress. Because of seo power of wordpress almost every my project I’m using wordpress. According to me wordpress is single but powerful framework. Maybe you already know about Custom Field Taxonomies in wordpress. It was pretty simple Custom Field Filter plug in. I use it lots of [...]]]></description>
			<content:encoded><![CDATA[<p>http://netinial.com/blog/wordpress/get_post_meta_multiple-pagination-and-ordering</p>
<div>
<h1><a title="WordPress get_post_meta_multiple, Pagination and Ordering." href="http://netinial.com/blog/wordpress/get_post_meta_multiple-pagination-and-ordering"> WordPress get_post_meta_multiple, Pagination and Ordering. </a></h1>
<p>Dealing with wordpress.</p>
<p>Because of seo power of wordpress almost every my project I’m using wordpress.<br />
According to me wordpress is single but powerful framework.</p>
<p>Maybe you already know about <a href="http://wordpress.org/extend/plugins/custom-field-taxonomies/" rel="nofollow">Custom Field Taxonomies</a> in wordpress.<br />
It was pretty simple Custom Field Filter plug in.</p>
<p>I use it lots of project that I manage.<br />
And also I was pretty happy with this plug in.</p>
<p>But after that 1.4 version they <a href="http://scribu.net/wordpress/custom-field-taxonomies/change-of-direction.html" rel="nofollow">changed their direction</a> of Custom Field Taxonomies from custom fields to tags.</p>
<p>As Custom Field Taxonomies alternative I searched near all of web.</p>
<p>Found 3 function as alternative.</p>
<p>wordpress -&gt; query_posts() was good function. But not supporting multiple filters.</p>
<p>I found <a href="http://idealienstudios.com/blog/wordpress/custom-field-query-quandry" rel="nofollow">get_post_meta_multiple</a> function thanks to the Jamie.</p>
<p>and <a href="http://www.mattvarone.com/wordpress/query-multiple-meta-values/" rel="nofollow">get_post_meta_multiple</a> (modified version of first) thanks to the Matt</p>
<p>Matt’s function was almost near the function that I looking for. But it was not supporting Order by, Order as, and Pagination also some problems about null category.<br />
You can see both pages people are asking about these, (me to <img src="http://netinial.com/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" /> )</p>
<p>I took some help from codes of <a href="http://wpquestions.com/question/show/id/616" rel="nofollow">Jignesh Patel</a> he has also another code to Pagination but I do not like it. to complicated.</p>
<p>Lastly I modified all of them (spend two days on it)</p>
<p>Hope to helps someone.</p>
<p>usage</p>
<div>
<div>
<pre>&lt;?php
$aMetaDataList = array('type' =&gt; 'Flat', 'for' =&gt; 'Sale');
global $resultList;
    $szCategory = 'NULL'; // All Categories will be shown, $szCategory = '1,2,3'; Only from 1,2,3
    $ppp = 5; // Post per page.
    $metaKey = 'total_property_size'; // Metakey to order.
    $orderBy = 'desc'; // orderBy = 'asc'; for Ascending
    $orderType = 'numerical'; // Order as Numerical, $orderType = 'Aphabetical'; Leave Blank Alphabetical
    $resultList = get_post_meta_multiple( $aMetaDataList, 'post', $szCategory, $ppp, $metaKey, $orderBy, $orderType);
?&gt;</pre>
</div>
</div>
<p>function comes here.</p>
<div>
<div>
<pre>&lt;?php
function get_post_meta_multiple( $aMetaDataList = array(), $szType = 'post', $szCategory = NULL, $ppp, $metaKey, $orderBy, $orderType)
{
    /**
     * @author Modified by Deniz Netinial.com
     * @copyright deniz [at] porsuk dot net
     * to modify I spend 1 week on it.
     * If you like this modification just send me an e mail, with thanks. SQL_NO_CACHE
     */

    global $wpdb,$wp_query;
    $szQuerystr = "SELECT SQL_Calc_Found_Rows $wpdb-&gt;posts.* FROM $wpdb-&gt;posts ";

    if ( $szCategory != NULL AND is_string($szCategory) )
    {
    $szQuerystr .= " INNER JOIN $wpdb-&gt;term_relationships ON ($wpdb-&gt;posts.ID = $wpdb-&gt;term_relationships.object_id) ";
    $szQuerystr .= " INNER JOIN $wpdb-&gt;term_taxonomy ON ($wpdb-&gt;term_relationships.term_taxonomy_id = $wpdb-&gt;term_taxonomy.term_taxonomy_id) ";
    }
    $szQuerystr .= " JOIN $wpdb-&gt;postmeta on ($wpdb-&gt;posts.ID = $wpdb-&gt;postmeta.post_id) WHERE ";

    if ( $szCategory != 'NULL' AND is_string($szCategory) )
    {
    $szQuerystr .= " 1=1 AND $wpdb-&gt;term_taxonomy.taxonomy = 'category' ";
    $szQuerystr .= " AND $wpdb-&gt;term_taxonomy.term_id IN(".$szCategory.")  AND ";
    }

    $szQuerystr .= " $wpdb-&gt;posts.post_type = '".$szType."' AND $wpdb-&gt;posts.post_status = 'publish'";

    if($metaKey){
    $szQuerystr .= " AND $wpdb-&gt;postmeta.meta_key = '".$metaKey."' ";
    }

    $aInnerqry = array();

    if(!empty($aMetaDataList))
    {
        $szQuerystr .= " Group By  $wpdb-&gt;posts.ID Having ";
        $szQuerystr .= " $wpdb-&gt;posts.ID IN (";
        $szQuerystr .= "SELECT $wpdb-&gt;postmeta.post_id FROM $wpdb-&gt;postmeta WHERE ";
        foreach($aMetaDataList as $szKey =&gt; $szValue)
        {
        $aInnerqry[] = $wpdb-&gt;prepare( "(meta_key = %s AND meta_value = %s)", $szKey, $szValue );
        }
    $szQuerystr .= implode(" OR ", $aInnerqry);
    $szQuerystr .= " GROUP BY $wpdb-&gt;postmeta.post_id ";
    $szQuerystr .= " HAVING count(*) = " . count($aMetaDataList)." ) ";
    }

    if(strtolower($orderType) == 'numerical')
      { $orderType = 'ABS'; }
    else { $orderType = ''; }

    if(!empty($aMetaDataList)) { $szQuerystr .= " ORDER BY ".$orderType."($wpdb-&gt;postmeta.meta_value) "; }
    else {  $szQuerystr .= " ORDER BY $wpdb-&gt;posts.post_date "; }

    if($orderBy == strtolower('desc')){ $szQuerystr .= " desc "; }else{ $szQuerystr .= " asc "; }

     # put limit in query built above */

    $aMetaResults = $wpdb-&gt;get_results($szQuerystr, OBJECT);

    if(!$ppp or !is_int($ppp))
    { $ppp = intval(get_query_var('posts_per_page')); } //12 posts per page you might use $ppp = intval(get_query_var('posts_per_page'));

    $wp_query-&gt;found_posts = count($aMetaResults);
    $wp_query-&gt;max_num_pages = ceil($wp_query-&gt;found_posts / $ppp);
    $on_page = intval(get_query_var('paged'));
    if($on_page == 0){ $on_page = 1; }
    $offset = ($on_page-1) * $ppp;

    $wp_query-&gt;request = $szQuerystr." LIMIT $ppp OFFSET $offset ";
    $pageposts = $wpdb-&gt;get_results($wp_query-&gt;request, OBJECT);

    echo mysql_error();

    echo ' --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- '.$szQuerystr;

    return $pageposts;
}
?&gt;</pre>
</div>
</div>
<p>and the loop</p>
<div>
<div>
<pre>&lt;?php
if ($resultList):
//Loop through each result post to display appropriate contents
$i = 0;
foreach ($resultList as $post):
	setup_postdata($post);
        echo '&lt;h1&gt;'.$resultList[0]-&gt;ID.'&lt;/h1&gt;';
endforeach;
?&gt;</pre>
</div>
</div>
<p>Here is the <a href="http://netinial.com/blog/wordpress/get_post_meta_multiple-v2-6-times-faster">second version</a> of this codes.</p>
</div>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://stefanomavilio.com/wordpress-custom-fields-and-taxonomy.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cambiare il from della mail di wordpress?</title>
		<link>http://stefanomavilio.com/cambiare-il-from-della-mail-di-wordpress.html</link>
		<comments>http://stefanomavilio.com/cambiare-il-from-della-mail-di-wordpress.html#comments</comments>
		<pubDate>Wed, 03 Aug 2011 00:27:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://stefanomavilio.com/?p=254</guid>
		<description><![CDATA[http://wordpress.org/support/topic/how-to-change-the-email-sender]]></description>
			<content:encoded><![CDATA[<p><a href="http://wordpress.org/support/topic/how-to-change-the-email-sender">http://wordpress.org/support/topic/how-to-change-the-email-sender</a></p>
]]></content:encoded>
			<wfw:commentRss>http://stefanomavilio.com/cambiare-il-from-della-mail-di-wordpress.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>valutazione di un sito di vino</title>
		<link>http://stefanomavilio.com/valutazione-di-un-sito-di-vino.html</link>
		<comments>http://stefanomavilio.com/valutazione-di-un-sito-di-vino.html#comments</comments>
		<pubDate>Tue, 12 Jul 2011 16:17:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://stefanomavilio.com/?p=250</guid>
		<description><![CDATA[http://www.intravino.com/primo-piano/viniamo-it-lo-smanettone-colpisce-ancora/]]></description>
			<content:encoded><![CDATA[<p>http://www.intravino.com/primo-piano/viniamo-it-lo-smanettone-colpisce-ancora/</p>
]]></content:encoded>
			<wfw:commentRss>http://stefanomavilio.com/valutazione-di-un-sito-di-vino.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>javascript motools</title>
		<link>http://stefanomavilio.com/javascript-motools.html</link>
		<comments>http://stefanomavilio.com/javascript-motools.html#comments</comments>
		<pubDate>Tue, 12 Jul 2011 12:28:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://stefanomavilio.com/?p=247</guid>
		<description><![CDATA[http://wall.plasm.it/examples/example-coda/ &#160; &#160;]]></description>
			<content:encoded><![CDATA[<p>http://wall.plasm.it/examples/example-coda/</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://stefanomavilio.com/javascript-motools.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>speeding open-x</title>
		<link>http://stefanomavilio.com/speeding-open-x.html</link>
		<comments>http://stefanomavilio.com/speeding-open-x.html#comments</comments>
		<pubDate>Fri, 08 Jul 2011 10:15:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[banner]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[open-x]]></category>

		<guid isPermaLink="false">http://stefanomavilio.com/?p=243</guid>
		<description><![CDATA[But wait &#8211; there’s more. You could place banners at the bottom of your HTML page (after all content) and then use javascript to reposition the banners. What this does is give the rest of the content higher priority and it will have a better chance of being loaded first. To help with this, please [...]]]></description>
			<content:encoded><![CDATA[<p>But wait &#8211; there’s more. You could place banners at the bottom of  your HTML page (after all content) and then use javascript to reposition  the banners. What this does is give the rest of the content higher  priority and it will have a better chance of being loaded first.</p>
<p>To help with this, please see this worked example for End of Page delivery: <a href="http://blog.openx.org/wp-content/uploads/eop-example.zip">eop-example</a>.</p>
<p>Inside  the zip file is an HTML page with 2 spots for banners, as well as some  fascinating content. At the bottom of the page are 2 invocation tags as  well as a call to a javascript function which will reposition the 2  banners to appear above where they are meant to. The javascript file can  most likely be kept as-is.</p>
<p><strong>What other things can you do to help speed?</strong></p>
<p>Caching is important. OpenX has built-in caching which limits calls  to the database &#8211; in a production environment you might want to increase  the cache time used by your installation. You might also want to  install a caching system for PHP on your server.</p>
<p>Keep in mind what 3rd parties you are using for banners. If you are  using external image banners or 3rd party HTML banners, not only must  OpenX deliver the banner but the 3rd party must then deliver the  image/HTML. Sometimes such external sources can be slow to load and  should be kept in mind when analyzing speed.</p>
]]></content:encoded>
			<wfw:commentRss>http://stefanomavilio.com/speeding-open-x.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

