<?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>Mike Van WinkleWordPress Hack: Reorder the Admin Menu | Mike Van Winkle</title>
	<atom:link href="http://www.mikevanwinkle.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikevanwinkle.com</link>
	<description>Wordpress/PHP Developer</description>
	<lastBuildDate>Thu, 05 Apr 2012 21:32:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>WordPress Hack: Reorder the Admin Menu</title>
		<link>http://www.mikevanwinkle.com/wordpress/wordpress-hack-reorder-the-admin-menu/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/wordpress-hack-reorder-the-admin-menu/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 21:26:20 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[admin_menu]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=1270</guid>
		<description><![CDATA[For many small business clients pages wind up being the most important WordPress post type. Many of them don&#8217;t even want a blog, just a nice looking site where they can update the content periodically, i.e. the contact page, the services page etc. So for these clients it&#8217;s often a little confusing to have &#8220;Posts&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>For many small business clients pages wind up being the most important WordPress post type. Many of them don&#8217;t even want a blog, just a nice looking site where they can update the content periodically, i.e. the contact page, the services page etc. </p>
<p>So for these clients it&#8217;s often a little confusing to have &#8220;Posts&#8221; at the top of the nav menu. Here&#8217;s how you would reorder to the nav to put pages on top. </p>
<p>First turn on the custom ordering option: </p>
<pre class="brush:php">
add_filter('custom_menu_order','__return_true');
</pre>
<p>Then create a function to filter the menu order array. In the function below we&#8217;re using array_splice to cut out the menu starting at position 2 because the &#8220;posts&#8221; menu item is #3 by default. How did I know that? Just add print_r($menu) and you&#8217;ll get a dump of the menu order.  After splicing the array, we iterate over the old menu array, the part we extracted ($old), using a foreach loop adding the old menu items back in. </p>
<pre class="brush:php">
function mc_menu_order($menu) {
// more on array_splice here: http://php.net/manual/en/function.array-splice.php
	$old = array_splice($menu,2,count($menu),array('2'=>'edit.php?post_type=page'));
	$keys = array_flip($menu);
	foreach($old as $item) {
		if(!array_key_exists($item,$keys)) {
			$menu[] = $item;
		}
	}
	unset($old);
	unset($keys);
	return $menu;
}
</pre>
<p>Then just add the api call to insert that function: </p>
<pre class="brush:php">
add_filter('menu_order','mc_menu_order');
</pre>
<p>Here it is all together:</p>
<pre class="brush:php">
//menu reorder
add_filter('custom_menu_order','__return_true');
add_filter('menu_order','mc_menu_order');
function mc_menu_order($menu) {
	$old = array_splice($menu,2,count($menu),array('2'=>'edit.php?post_type=page'));
	$keys = array_flip($menu);
	foreach($old as $item) {
		if(!array_key_exists($item,$keys)) {
			$menu[] = $item;
		}
	}
	unset($old);
	unset($keys);
	return $menu;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/wordpress-hack-reorder-the-admin-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Plugin Shoutout : Advanced Custom Fields</title>
		<link>http://www.mikevanwinkle.com/wordpress/plugin-shoutout-advanced-custom-fields/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/plugin-shoutout-advanced-custom-fields/#comments</comments>
		<pubDate>Mon, 02 Apr 2012 15:56:43 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=1258</guid>
		<description><![CDATA[Like most developers, I have a tendency to want to code everything from scratch. I suppose like any craftsman, there&#8217;s a resistance to relying on a machine to do work you enjoy doing with your hands. But sometimes the challenges of a particular project force your hand and you need to save time on meta [...]]]></description>
			<content:encoded><![CDATA[<p>Like most developers, I have a tendency to want to code everything from scratch. I suppose like any craftsman, there&#8217;s a resistance to relying on a machine to do work you enjoy doing with your hands. But sometimes the challenges of a particular project force your hand and you need to save time on meta boxes and custom fields and spend more time on other aspects of the project. Lately I&#8217;ve been relying on <a title="Advanced Custom Fields" href="http://wordpress.org/extend/plugins/advanced-custom-fields/" target="_blank">Advanced Custom Fields</a> for managing custom fields and I&#8217;ve been very impressed.</p>
<p>The interface is smooth and as far as I can tell so far, there&#8217;s no front end performance hit. Though, I must admit I do not use the front-end functions provided by ACF and instead prefer to rely on the standard &lt;code&gt;get_post_meta()&lt;/code&gt; approach.</p>
<p>But there are two things specifically I enjoy about this plugin. First, it gives you the option to have your &#8220;field group&#8221; either inside an expandable meta box. This is the standard way custom fields are presented. But it also gives you the ability to add the fields right into the form with no meta box wrapping element. This gives your form some variety. (see screen shots)</p>
<p><a href="http://www.mikevanwinkle.com/wp-content/uploads/2012/04/Screen-shot-2012-04-02-at-8.21.45-AM.png"><img class="aligncenter size-medium wp-image-1261" title="Standard" src="http://www.mikevanwinkle.com/wp-content/uploads/2012/04/Screen-shot-2012-04-02-at-8.21.45-AM-264x300.png" alt="" width="264" height="300" /></a></p>
<p><a href="http://www.mikevanwinkle.com/wp-content/uploads/2012/04/Screen-shot-2012-04-02-at-8.22.13-AM.png"><img class="aligncenter size-medium wp-image-1260" title="Screen shot 2012-04-02 at 8.22.13 AM" src="http://www.mikevanwinkle.com/wp-content/uploads/2012/04/Screen-shot-2012-04-02-at-8.22.13-AM-252x300.png" alt="" width="252" height="300" /></a></p>
<p>The second thing I really enjoy about this plugin is the API for adding custom field types. Developers always love finding an organized API when they need one. For this specific project I need a field where the user could select a NextGen Gallery from a dropdown. All I had to do was <a title="NextGen ACF Field" href="http://www.mikevanwinkle.com/snippet/nextgen-acf-field">create a class extending the acfField</a>. Then add the following to my functions.php:</p>
<pre class="brush:php">
add_action('acf_register_field','ngg_register_acf_field');
function ngg_register_acf_field() {
	add_filter('acf_register_field','ngg_field',0,1);
}

function ngg_field($custom) {
	global $acf;
	$ngg = array('class'=>'acf_NGG_Gallery','url'=>PATHTODIR.'/acf_ngg.php');
	$custom['ngg'] = $ngg;
	return $custom;
   }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/plugin-shoutout-advanced-custom-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVN Tips That Saved My Ass Once</title>
		<link>http://www.mikevanwinkle.com/tips/svn-tips-the-saved-my-ass-once/</link>
		<comments>http://www.mikevanwinkle.com/tips/svn-tips-the-saved-my-ass-once/#comments</comments>
		<pubDate>Thu, 15 Mar 2012 16:11:31 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=1251</guid>
		<description><![CDATA[Ever need to deploy a version controlled site that overwrites existing files? This is common when taking a site from un-versioned to versioned. First checkout the files using the force option. svn checkout --force http://vanwinkle.somesvnserver.com/trunk/ ./ This will force the checkout process to complete, but your old files will not really be overwritten. Instead they [...]]]></description>
			<content:encoded><![CDATA[<p>Ever need to deploy a version controlled site that overwrites existing files? This is common when taking a site from un-versioned to versioned. </p>
<p>First checkout the files using the force option. </p>
<pre class="brush:php">
svn checkout --force http://vanwinkle.somesvnserver.com/trunk/ ./
</pre>
<p>This will force the checkout process to complete, but your old files will not really be overwritten. Instead they will be considered modified version of the corresponding file in the repo. So to complete the process you need to do:</p>
<pre class="brush:php">
svn revert -R ./
</pre>
<p>This tells subversion to &#8220;revert&#8221; the files in the existing directory to the versioned state. The -R tells it to do this recursively and the ./ tells it to start in the current directory. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/tips/svn-tips-the-saved-my-ass-once/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Developing With WordPress</title>
		<link>http://www.mikevanwinkle.com/wordpress/developing-with-wordpress/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/developing-with-wordpress/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 18:17:17 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=1233</guid>
		<description><![CDATA[Andrew Norcross&#8217; presentation on developing with WordPress is worth a watch (or listen):]]></description>
			<content:encoded><![CDATA[<p>Andrew Norcross&#8217; presentation on developing with WordPress is worth a watch (or listen): </p>
<p><embed type="application/x-shockwave-flash" src="http://s0.videopress.com/player.swf?v=1.03" width="565" height="350" wmode="direct" seamlesstabbing="true" allowfullscreen="true" allowscriptaccess="always" overstretch="true" flashvars="guid=kkJo8vJ1&amp;isDynamicSeeking=true"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/developing-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PyroCMS Links Module Goes Live</title>
		<link>http://www.mikevanwinkle.com/pyrocms/pyrocms-links-module-goes-live/</link>
		<comments>http://www.mikevanwinkle.com/pyrocms/pyrocms-links-module-goes-live/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 16:24:08 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[PyroCMS]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=1228</guid>
		<description><![CDATA[Wow, it&#8217;s been a while I guess. Been working too much as usual. And also, my PyroCMS Links Module is now available in the PyroCMS store. Yay! Get the Links Module]]></description>
			<content:encoded><![CDATA[<p>Wow, it&#8217;s been a while I guess. Been working too much as usual. And also, my PyroCMS Links Module is now available in the PyroCMS store. Yay!</p>
<p><a href="http://www.pyrocms.com/store/details/links_module" title="PyroCMS Links Module">Get the Links Module</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/pyrocms/pyrocms-links-module-goes-live/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Portable Database Caching Class</title>
		<link>http://www.mikevanwinkle.com/wordpress/wordpress-portable-database-caching-class/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/wordpress-portable-database-caching-class/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 18:33:06 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[BuddyPress]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=1222</guid>
		<description><![CDATA[So here&#8217;s a little library/class that I wrote to make caching a little easier from project to project. WordPress requires a plugin like W3 Total Cache to be in place for &#8220;persistent&#8221; caching to be available &#8230; that is, caches of data that survive longer than the current page view. But sometimes when you&#8217;re building [...]]]></description>
			<content:encoded><![CDATA[<p>So here&#8217;s a <a title="Simple WordPress Database Caching Class for Developers" href="http://www.mikevanwinkle.com/projects/simple-wordpress-database-caching-class-for-developers/">little library/class</a> that I wrote to make caching a little easier from project to project. WordPress requires a plugin like W3 Total Cache to be in place for &#8220;persistent&#8221; caching to be available &#8230; that is, caches of data that survive longer than the current page view. But sometimes when you&#8217;re building a complex custom project there are some queries you know could be safely cached regardless of the global caching setup. With this class you can build it right into your theme or plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/wordpress-portable-database-caching-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove the Admin Bar for Non-admin Users</title>
		<link>http://www.mikevanwinkle.com/wordpress/remove-the-admin-bar-for-non-admin-users/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/remove-the-admin-bar-for-non-admin-users/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 20:44:30 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=1204</guid>
		<description><![CDATA[if(!current_user_can('administrator')) { add_filter('show_admin_bar','__return_false'); remove_action('wp_head','_admin_bar_bump_cb'); }]]></description>
			<content:encoded><![CDATA[<pre class="brush:php">
		if(!current_user_can('administrator')) {
			add_filter('show_admin_bar','__return_false');
			remove_action('wp_head','_admin_bar_bump_cb');
		}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/remove-the-admin-bar-for-non-admin-users/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress Caching: Clear An Individual WordPress Post Cache</title>
		<link>http://www.mikevanwinkle.com/wordpress/wordpress-caching-clear-an-individual-wordpress-post-cache/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/wordpress-caching-clear-an-individual-wordpress-post-cache/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 23:08:50 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Caching]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=1202</guid>
		<description><![CDATA[I&#8217;ve become a bit obsessed with caching lately. Speed is an addiction I suppose. So I found another new trick today. If your writing a plugin or theme and have some front in functionality adding and updating posts, sometimes you want to make sure a cached object is cleared before the page is refreshed. But [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve become a bit obsessed with caching lately. Speed is an addiction I suppose. So I found another new trick today. If your writing a plugin or theme and have some front in functionality adding and updating posts, sometimes you want to make sure a cached object is cleared before the page is refreshed. But you don&#8217;t want to dump the whole object cache, especially if there are thousands of posts. So to just dump one post you can simply do this:</p>
<pre class="brush:php">
wp_cache_delete($post_id,'posts');
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/wordpress-caching-clear-an-individual-wordpress-post-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I&#8217;m Lovin Pyrocms</title>
		<link>http://www.mikevanwinkle.com/wordpress/why-im-lovin-pyrocms/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/why-im-lovin-pyrocms/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 17:49:13 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[PyroCMS]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=1196</guid>
		<description><![CDATA[So in my admittedly-limited free time I&#8217;ve been working on some PyroCMS-based projects and the more I work with it the more I love it. The main reason is that it&#8217;s built using Codeigniter which is a custom PHP framework. So if you know how to develop with CI you can easily get going with [...]]]></description>
			<content:encoded><![CDATA[<p>So in my admittedly-limited free time I&#8217;ve been working on some <a title="PyroCMS" href="http://www.pyrocms.com/">PyroCMS-based</a> projects and the more I work with it the more I love it. The main reason is that it&#8217;s built using <a title="Codeigniter" href="http://codeigniter.com/">Codeigniter</a> which is a custom PHP framework. So if you know how to develop with CI you can easily get going with PyroCMS. And because it&#8217;s built on a custom framework, there&#8217;s a structure for customization.</p>
<p>By contrast if you&#8217;re developing with WordPress and you reach a point where you have to go beyond core and start building custom plugins there&#8217;s really no pattern to follow. Sure there are hooks and filters that allow you to customize as much as you want. But because WP is not a <em>custom</em> framework, it isn&#8217;t built for customization and there are no internal conventions for full-on custom modification. So each plugin you look at has a slightly different approach to accomplishing goals. The <a href="http://www.podscms.org">Pods CMS</a> project attempts to create a standard for customization, but it has not yet been fully developed or fully adopted.</p>
<p>PyroCMS on the other hand, being CI based, strictly follows the MVC pattern and thus allows developers to anticipate the structure of any module, and replicate and override those modules if necessary. This is what custom frameworks setup to do. PyroCMS combines the code-base scalability with WordPress like features and the ability to quickly launch sites. Though, it still has a ways to go match up with WordPress on features.</p>
<p>This distinction is relevant for clients too. You decide to save on development costs and use a system like WordPress for your CMS. But then you start customizing everything and before you know it what you really have is a custom site attached to a WordPress install. This is fine until your developer goes on to bigger and better projects and you have to find a new one. Well, your WordPress install is too hacked and customized for average WordPress developers to handle. But because it wasn&#8217;t built on a custom framework, PHP developers will not be able to easily and quickly understand how the site was setup. Either way the cost of maintenance is going to be considerably higher than if you had gone custom in the first place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/why-im-lovin-pyrocms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress $current_user Global Changed in WordPress 3.3</title>
		<link>http://www.mikevanwinkle.com/wordpress/wordpress-current_user-global-changed-in-wordpress-3-3/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/wordpress-current_user-global-changed-in-wordpress-3-3/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 03:00:00 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=1189</guid>
		<description><![CDATA[WordPress has been slowly changing their global $current_user object and the changes in WordPress 3.3 broke my Simplr Registration Form Plus plugin and probably a few others. For any other developers trying to investigate why usermeta field values disappear it is because: global $current_user; This was used to return an object containing not only the [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress has been slowly changing their global $current_user object and the changes in WordPress 3.3 broke my <a href="/simplr-registration-form-plus">Simplr Registration Form Plus</a> plugin and probably a few others. For any other developers trying to investigate why usermeta field values disappear it is because:</p>
<pre class="brush:php">global $current_user;</pre>
<p>This was used to return an object containing not only the primary user fields but all the meta fields as well. So if you set a user meta field called &#8220;age&#8221; you could simply do:</p>
<pre class="brush:php">
global $current_user;
if($current_user->data->age > 21) {
  // the do some adult stuff;
}
</pre>
<p>But this shortcut is no longer available to developers and for good reason. As a general rule code should be efficient, meaning it does only what it has to. To load even the most superflous meta fields every time you access the basic user object is a waste of resources. </p>
<p>So good for WordPress, they are improving. But there are likely others like me who figured if WordPress was going to give me the info, then I was going to use it. And like me they&#8217;ll have to spend all day tracking down everywhere they used this shortcut and fixing it. Ugh. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/wordpress-current_user-global-changed-in-wordpress-3-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: www.mikevanwinkle.com @ 2012-05-17 22:47:23 by W3 Total Cache -->
