<?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>Matt Varone &#187; WordPress</title> <atom:link href="http://www.mattvarone.com/category/wordpress/feed/" rel="self" type="application/rss+xml" /><link>http://www.mattvarone.com</link> <description>Creative Developer</description> <lastBuildDate>Wed, 21 Dec 2011 18:44:45 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Simple WordPress Gallery to Slideshow</title><link>http://www.mattvarone.com/wordpress/wordpress-gallery-slideshow/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-gallery-slideshow</link> <comments>http://www.mattvarone.com/wordpress/wordpress-gallery-slideshow/#comments</comments> <pubDate>Mon, 08 Aug 2011 18:31:13 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Plugins]]></category> <category><![CDATA[Resources]]></category> <guid
isPermaLink="false">http://www.mattvarone.com/?p=1618</guid> <description><![CDATA[Released a small plugin that turns the built-in WordPress gallery &#8230; <a
href="http://www.mattvarone.com/wordpress/wordpress-gallery-slideshow/" title="Continue Reading">Continue <span
class="meta-nav">&#8594;</span></a><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/wordpress-gallery-slideshow/">Simple WordPress Gallery to Slideshow</a></p> ]]></description> <content:encoded><![CDATA[<p>Released a <a
href="http://www.mattvarone.com/featured-content/gallery-to-slideshow/" title="Gallery To Slideshow">small plugin</a> that turns the built-in WordPress gallery into a responsive jQuery slideshow.</p><p><a
href="http://www.mattvarone.com/featured-content/gallery-to-slideshow/" title="Gallery To Slideshow"><img
src="http://www.mattvarone.com/wp-content/uploads/2011/08/screenshot-1.jpg" alt="" title="screenshot-1" width="530" height="588" class="aligncenter size-full wp-image-1619" /><br
/> </a><br
/><p
class="post-box"><a
href="http://www.mattvarone.com/featured-content/gallery-to-slideshow/" title="Gallery To Slideshow">Click here</a> to learn more.</p></p><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/wordpress-gallery-slideshow/">Simple WordPress Gallery to Slideshow</a></p> ]]></content:encoded> <wfw:commentRss>http://www.mattvarone.com/wordpress/wordpress-gallery-slideshow/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>List users with WP_User_Query</title><link>http://www.mattvarone.com/wordpress/list-users-with-wp_user_query/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=list-users-with-wp_user_query</link> <comments>http://www.mattvarone.com/wordpress/list-users-with-wp_user_query/#comments</comments> <pubDate>Wed, 03 Aug 2011 01:41:01 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Template Functions]]></category> <category><![CDATA[Workflow]]></category> <guid
isPermaLink="false">http://www.mattvarone.com/?p=1197</guid> <description><![CDATA[WordPress 3.1 included a new cool class called WP_User_Query. As &#8230; <a
href="http://www.mattvarone.com/wordpress/list-users-with-wp_user_query/" title="Continue Reading">Continue <span
class="meta-nav">&#8594;</span></a><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/list-users-with-wp_user_query/">List users with WP_User_Query</a></p> ]]></description> <content:encoded><![CDATA[<p>WordPress 3.1 included a new cool class called <a
href="http://codex.wordpress.org/Function_Reference/WP_User_Query">WP_User_Query</a>. As the name implies, it allows querying the WordPress User database trough it&#8217;s available methods. It&#8217;s a much welcome addition which deprecates <code>WP_User_Search</code> and makes it very easy to retrieve specific users from the database.</p><p>Here is a simple example of <code>WP_User_Query</code> in action:</p><pre class="brush: php; title: ; notranslate">
// prepare arguments
$args  = array(
// search only for Authors role
'role' =&gt; 'Author',
// order results by display_name
'orderby' =&gt; 'display_name',
// check for two meta_values
'meta_query' =&gt; array(
	array(
		// uses compare like WP_Query
		'key' =&gt; 'some_user_meta_key',
		'value' =&gt; 'some user meta value',
		'compare' =&gt; '&gt;'
		),
	array(
		// by default compare is '='
		'key' =&gt; 'some_other_user_meta_key',
		'value' =&gt; 'some other meta value',
		),
	// add more
));
// Create the WP_User_Query object
$wp_user_query = new WP_User_Query($args);
// Get the results
$authors = $wp_user_query-&gt;get_results();
// Check for results
if (!empty($authors))
{
	echo '&lt;ul&gt;';
	// loop trough each author
	foreach ($authors as $author)
	{
		// get all the user's data
		$author_info = get_userdata($author-&gt;ID);
		echo '&lt;li&gt;'.$author_info-&gt;first_name.' '.$author_info-&gt;last_name.'&lt;/li&gt;';
	}
	echo '&lt;/ul&gt;';
} else {
	echo 'No authors found';
}
</pre><h3>Parameters</h3><p>To tweak the search terms the <code>WP_User_Query</code> constructor allows the following parameters:</p><p><strong>blog_id</strong> (int)<br
/> The blog id on a multisite environment. Defaults to the current blog id.</p><p><strong>role</strong> (string)<br
/> The user&#8217;s role.</p><p><strong>meta_key</strong> (string)<br
/> <strong>meta_value</strong> (string)<br
/> <strong>meta_compare</strong> (string)<br
/> Same as <code>WP_Query</code> ( <a
href="http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters" title="Custom Fields">view</a> ).</p><p><strong>include</strong> (array)<br
/> Array of users id to include.</p><p><strong>exclude</strong> (array)<br
/> Array of users id to exclude.</p><p><strong>search</strong> (string)<br
/> Searches for possible string matches on columns <code>user_email</code>, <code>user_login</code>,<code>ID</code>,<code>user_url</code>, <code>user_login</code> and <code>user_nicename</code>.</p><p><strong>orderby</strong> (string)<br
/> <code>login</code>, <code>'nicename'</code>, <code>'email'</code>, <code>'url'</code>, <code>'registered'</code>. Defaults to <code>login</code>.</p><p><strong>order</strong> (string)<br
/> Defaults to <code>ASC</code> (ascending order).</p><p><strong>offset</strong> (int)<br
/> Offset results ( handy for pagination ).</p><p><strong>count_total</strong> (boolean)<br
/> If <code>true</code> returns the total of users found.</p><p><strong>number</strong> (int)<br
/> Limit of users to retrieve.</p><p><strong>fields (all)</strong><br
/> Which fields to return. Defaults to <code>all</code>.</p><h3>Conclusion</h3><p>Now it&#8217;s awesomely simple to create users listings. I would suggest pagination and caching results for websites with lots of users as these queries can get pretty heavy.</p><p>Hope you find the code useful, if you have any comments or suggestions please feel free to leave them in the comments. Thanks for reading!</p><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/list-users-with-wp_user_query/">List users with WP_User_Query</a></p> ]]></content:encoded> <wfw:commentRss>http://www.mattvarone.com/wordpress/list-users-with-wp_user_query/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Cleaner output for wp_nav_menu()</title><link>http://www.mattvarone.com/wordpress/cleaner-output-for-wp_nav_menu/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=cleaner-output-for-wp_nav_menu</link> <comments>http://www.mattvarone.com/wordpress/cleaner-output-for-wp_nav_menu/#comments</comments> <pubDate>Fri, 29 Jul 2011 15:38:38 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Navigation Bars]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Resources]]></category> <category><![CDATA[Template Functions]]></category> <guid
isPermaLink="false">http://www.mattvarone.com/?p=1472</guid> <description><![CDATA[If you are looking for a way to have a &#8230; <a
href="http://www.mattvarone.com/wordpress/cleaner-output-for-wp_nav_menu/" title="Continue Reading">Continue <span
class="meta-nav">&#8594;</span></a><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/cleaner-output-for-wp_nav_menu/">Cleaner output for wp_nav_menu()</a></p> ]]></description> <content:encoded><![CDATA[<p>If you are looking for a way to have a clean navigation list without the default classes and ids then the simplest solution I found is to extend the <a
href="http://codex.wordpress.org/Function_Reference/Walker_Class">Walker</a> class with a modified version of the <code>Walker_Nav_Menu</code> class.</p><p>The code below is for my custom <code>Walker</code> which is actually the same code as the navigation Walker shipped with WordPress minus the echo of default CSS classes and ids. To make this work simply drop the code in your theme&#8217;s <code>functions.php</code>.</p><pre class="brush: php; title: ; notranslate">
&lt;?php
class MV_Cleaner_Walker_Nav_Menu extends Walker {
	var $tree_type = array( 'post_type', 'taxonomy', 'custom' );
	var $db_fields = array( 'parent' =&gt; 'menu_item_parent', 'id' =&gt; 'db_id' );
	function start_lvl(&amp;$output, $depth) {
		$indent = str_repeat(&quot;\t&quot;, $depth);
		$output .= &quot;\n$indent&lt;ul class=\&quot;sub-menu\&quot;&gt;\n&quot;;
	}
	function end_lvl(&amp;$output, $depth) {
		$indent = str_repeat(&quot;\t&quot;, $depth);
		$output .= &quot;$indent&lt;/ul&gt;\n&quot;;
	}
	function start_el(&amp;$output, $item, $depth, $args) {
		global $wp_query;
		$indent = ( $depth ) ? str_repeat( &quot;\t&quot;, $depth ) : '';
		$class_names = $value = '';
		$classes = empty( $item-&gt;classes ) ? array() : (array) $item-&gt;classes;
		$classes = in_array( 'current-menu-item', $classes ) ? array( 'current-menu-item' ) : array();
		$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
		$class_names = strlen( trim( $class_names ) ) &gt; 0 ? ' class=&quot;' . esc_attr( $class_names ) . '&quot;' : '';
		$id = apply_filters( 'nav_menu_item_id', '', $item, $args );
		$id = strlen( $id ) ? ' id=&quot;' . esc_attr( $id ) . '&quot;' : '';
		$output .= $indent . '&lt;li' . $id . $value . $class_names .'&gt;';
		$attributes  = ! empty( $item-&gt;attr_title ) ? ' title=&quot;'  . esc_attr( $item-&gt;attr_title ) .'&quot;' : '';
		$attributes .= ! empty( $item-&gt;target )     ? ' target=&quot;' . esc_attr( $item-&gt;target     ) .'&quot;' : '';
		$attributes .= ! empty( $item-&gt;xfn )        ? ' rel=&quot;'    . esc_attr( $item-&gt;xfn        ) .'&quot;' : '';
		$attributes .= ! empty( $item-&gt;url )        ? ' href=&quot;'   . esc_attr( $item-&gt;url        ) .'&quot;' : '';
		$item_output = $args-&gt;before;
		$item_output .= '&lt;a'. $attributes .'&gt;';
		$item_output .= $args-&gt;link_before . apply_filters( 'the_title', $item-&gt;title, $item-&gt;ID ) . $args-&gt;link_after;
		$item_output .= '&lt;/a&gt;';
		$item_output .= $args-&gt;after;
		$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
	}
	function end_el(&amp;$output, $item, $depth) {
		$output .= &quot;&lt;/li&gt;\n&quot;;
	}
}
?&gt;
</pre><p>Then make sure to specify the new custom Walker when calling <code>wp_nav_menu()</code>.</p><pre class="brush: php; title: ; notranslate">
&lt;?php
 wp_nav_menu( array( 'walker' =&gt; new MV_Cleaner_Walker_Nav_Menu() ) );
?&gt;
</pre><p>Example:</p><pre class="brush: php; title: ; notranslate">
&lt;ul id=&quot;menu-main&quot; class=&quot;menu&quot;&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.mattvarone.com/about/&quot;&gt;About&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.mattvarone.com/featured-content/&quot;&gt;Featured&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.mattvarone.com/contact/&quot;&gt;Contact&lt;/a&gt;&lt;/li&gt;
	&lt;li&gt;&lt;a href=&quot;http://www.mattvarone.com/blog/&quot;&gt;Blog&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</pre><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/cleaner-output-for-wp_nav_menu/">Cleaner output for wp_nav_menu()</a></p> ]]></content:encoded> <wfw:commentRss>http://www.mattvarone.com/wordpress/cleaner-output-for-wp_nav_menu/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>WP Install: AppleScript for Mac</title><link>http://www.mattvarone.com/wordpress/wp-install-for-mac/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wp-install-for-mac</link> <comments>http://www.mattvarone.com/wordpress/wp-install-for-mac/#comments</comments> <pubDate>Sat, 16 Jul 2011 15:26:02 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Helpers]]></category> <category><![CDATA[Mac]]></category> <category><![CDATA[Resources]]></category> <category><![CDATA[Tip]]></category> <category><![CDATA[Workflow]]></category> <guid
isPermaLink="false">http://www.mattvarone.com/?p=1271</guid> <description><![CDATA[Little useful ( free ) app to quickly install the &#8230; <a
href="http://www.mattvarone.com/wordpress/wp-install-for-mac/" title="Continue Reading">Continue <span
class="meta-nav">&#8594;</span></a><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/wp-install-for-mac/">WP Install: AppleScript for Mac</a></p> ]]></description> <content:encoded><![CDATA[<p><img
class="aligncenter size-full border" title="WPinstall" src="http://www.mattvarone.com/wp-content/uploads/2011/07/WPinstall.jpg" alt="" width="570" height="325" /></p><p>Little useful ( free ) app to quickly install the latest version of WordPress on any given folder. Made from this <a
title="Install WordPress from the OSX Terminal" href="http://www.mattvarone.com/web-design/install-wordpress-from-the-osx-terminal/">shell script</a>.</p><p
class="post-box">Download the app <a
title="WP Install" href="http://www.mattvarone.com/wp-content/uploads/2011/07/WPInstall.zip">Here</a></p><p>Feel free to leave comments and suggestions.</p><p><em>* Awesome icon by TurboMilk</em></p><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/wp-install-for-mac/">WP Install: AppleScript for Mac</a></p> ]]></content:encoded> <wfw:commentRss>http://www.mattvarone.com/wordpress/wp-install-for-mac/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Easy Members Only with Shortcodes Pro</title><link>http://www.mattvarone.com/wordpress/easy-members-only-with-shortcodes-pro/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=easy-members-only-with-shortcodes-pro</link> <comments>http://www.mattvarone.com/wordpress/easy-members-only-with-shortcodes-pro/#comments</comments> <pubDate>Tue, 28 Jun 2011 19:31:23 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Helpers]]></category> <category><![CDATA[Workflow]]></category> <guid
isPermaLink="false">http://www.mattvarone.com/?p=1247</guid> <description><![CDATA[Learn how to quickly create a members only shortcode and &#8230; <a
href="http://www.mattvarone.com/wordpress/easy-members-only-with-shortcodes-pro/" title="Continue Reading">Continue <span
class="meta-nav">&#8594;</span></a><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/easy-members-only-with-shortcodes-pro/">Easy Members Only with Shortcodes Pro</a></p> ]]></description> <content:encoded><![CDATA[<p>Learn how to quickly create a members only shortcode and TinyMCE button for WordPress with <a
title="Shortcodes Pro Plugin for WordPress" href="http://www.mattvarone.com/featured-content/shortcodes-pro/">Shortcodes Pro</a>.</p> <iframe
width="590" height="410" src="http://www.youtube.com/embed/Ai56zFq-B3g?rel=0" frameborder="0" allowfullscreen></iframe><br/><p>Shortcode Code:</p><pre class="brush: php; title: ; notranslate">
if ( is_user_logged_in() )
return $content;
else
return $atts['message'];
</pre><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/easy-members-only-with-shortcodes-pro/">Easy Members Only with Shortcodes Pro</a></p> ]]></content:encoded> <wfw:commentRss>http://www.mattvarone.com/wordpress/easy-members-only-with-shortcodes-pro/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>WordPress Browser Body Classes Function</title><link>http://www.mattvarone.com/wordpress/browser-body-classes-function/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=browser-body-classes-function</link> <comments>http://www.mattvarone.com/wordpress/browser-body-classes-function/#comments</comments> <pubDate>Tue, 28 Jun 2011 18:30:33 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[WordPress]]></category> <category><![CDATA[Helpers]]></category> <category><![CDATA[Template Functions]]></category> <guid
isPermaLink="false">http://www.mattvarone.com/?p=1234</guid> <description><![CDATA[Browser sniffing sucks you say? Well you are totally right, &#8230; <a
href="http://www.mattvarone.com/wordpress/browser-body-classes-function/" title="Continue Reading">Continue <span
class="meta-nav">&#8594;</span></a><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/browser-body-classes-function/">WordPress Browser Body Classes Function</a></p> ]]></description> <content:encoded><![CDATA[<p>Browser sniffing sucks you say? Well you are totally right, yet it can get you out of trouble in one or other occasion and thats makes it worth the attention. This is a little function I borrowed from <a
href="http://www.nathanrice.net/blog/browser-detection-and-the-body_class-function/">Nathan Rice</a> that does the job pretty well. I added some code from the <a
href="http://wordpress.org/extend/plugins/krusty-msie-body-classes/">Krusty</a> classes plugin to have IE versions as classes for more specific targeting. Hope you find it useful, enjoy!</p><pre class="brush: php; title: ; notranslate">
/*
|--------------------------------------------------------------------------
| BROWSER CLASSES
|--------------------------------------------------------------------------
*/
if ( ! function_exists( 'mv_browser_body_class' ) )
{
	function mv_browser_body_class( $classes ) {
		global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
		if( $is_lynx ) $classes[] = 'lynx';
		elseif( $is_gecko ) $classes[] = 'gecko';
		elseif( $is_opera ) $classes[] = 'opera';
		elseif( $is_NS4 ) $classes[] = 'ns4';
		elseif( $is_safari ) $classes[] = 'safari';
		elseif( $is_chrome ) $classes[] = 'chrome';
		elseif( $is_IE ) {
			$classes[] = 'ie';
			if( preg_match( '/MSIE ( [0-9]+ )( [a-zA-Z0-9.]+ )/', $_SERVER['HTTP_USER_AGENT'], $browser_version ) )
			$classes[] = 'ie' . $browser_version[1];
		} else $classes[] = 'unknown';
		if( $is_iphone ) $classes[] = 'iphone';
		return $classes;
	}
	add_filter( 'body_class','mv_browser_body_class' );
}
</pre><p>This is a post from: <a
href="http://www.mattvarone.com">Matt Varone</a><br/><br/><a
href="http://www.mattvarone.com/wordpress/browser-body-classes-function/">WordPress Browser Body Classes Function</a></p> ]]></content:encoded> <wfw:commentRss>http://www.mattvarone.com/wordpress/browser-body-classes-function/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
