<?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>Matthew A Price</title>
	<atom:link href="http://matthewaprice.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://matthewaprice.com</link>
	<description>all code on deck</description>
	<lastBuildDate>Thu, 02 May 2013 19:06:23 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Static Website Template Engine</title>
		<link>http://matthewaprice.com/static-website-template-engine/</link>
		<comments>http://matthewaprice.com/static-website-template-engine/#comments</comments>
		<pubDate>Fri, 11 Jan 2013 20:05:25 +0000</pubDate>
		<dc:creator>Matthew Price</dc:creator>
				<category><![CDATA[templates]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[static]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://matthewaprice.com/?p=1912</guid>
		<description><![CDATA[<p>I have made some static webpages recently and I have been meaning to make an extremely simple template engine that will drive these sites. &#160;I always have a library of functions for getting html headers, footers and common functions, but I didn't have the template portion. &#160;Here is a very easy to implement system that allows you to make static websites that do not need databases that load very fast. &#160;It basically lets you define a set of pages and then will automatically serve the correct page from a folder. &#160;This is instead of having to make new folders and index files for each new page.</p>
]]></description>
				<content:encoded><![CDATA[<p><i>Update April 14, 2013:</i><br />
The following sites are using this tool:<br />
<a href="http://uchooseslider.com">http://uchooseslider.com</a></p>
<hr />
I have made some static webpages recently and I have been meaning to make an extremely simple template engine that will drive these sites.  I always have a library of functions for getting html headers, footers and common functions, but I didn&#8217;t have the template portion.  Here is a very easy to implement system that allows you to make static websites that do not need databases that load very fast.  It basically lets you define a set of pages and then will automatically serve the correct page from a folder.  This is instead of having to make new folders and index files for each new page.</p>
<p>I am using the <a href="http://twitter.github.com/bootstrap">Twitter Bootstrap</a> for this example</p>
<p>Here is the folder structure:</p>
<pre class="prettyprint linenums language-html">
/css/bootstrap.css
/css/bootstrap-responsive.css
/img/ &lt;!-- contains all of the site images --&gt;
/inc/min &lt;!-- contains the minifier --&gt;
/inc/functions.php &lt;!-- contains the php functions that drive the site --&gt;
/view/  &lt;!-- contains all of the template files that are dynamically served --&gt;
/index.php &lt;!-- this file determines which files to serve
</pre>
<p><a href="http://dev2.matthewaprice.com" target="_blank" class="btn">View the demo here</a><br />
(note: the demo links that work are in the header.  you can also try to put in url like &#8216;/dfgkjdf/&#8217; and you will see the 404 page)</p>
<p>The first thing we need to to is setup some global variables that will enable the site to function</p>
<pre class="prettyprint linenums language-php">
&lt;?php
// define a list of the pages that exist on your site.  these will be the page slugs
$PAGE_ARRAY = array(
	'home','about','contact'
);

$URI = $_SERVER['REQUEST_URI'];
$PAGE_TO_SERVE = preg_replace( '/\//', '', $URI );
define( 'PAGE_TO_SERVE', $PAGE_TO_SERVE ); // Get current page slug
?&gt;
</pre>
<p>Next we need to setup some functions that load the site&#8217;s header and footer.  There are two functions in here that will be explained after the header and footer (<code>load_css()</code> and <code>load_javascript()</code>)</p>
<pre class="prettyprint linenums language-html">
function display_header() {
     global $PAGE_ARRAY;
?&gt;
&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Bootstrap, from Twitter&lt;/title&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    &lt;meta name="description" content=""&gt;
    &lt;meta name="author" content=""&gt;

    &lt;?php load_css(); ?&gt;

    &lt;style type="text/css"&gt;
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      .sidebar-nav {
        padding: 9px 0;
      }
    &lt;/style&gt;

    &lt;!-- HTML5 shim, for IE6-8 support of HTML5 elements --&gt;
    &lt;!--[if lt IE 9]&gt;
      &lt;script src="http://html5shim.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt;
    &lt;![endif]--&gt;

  &lt;/head&gt;

  &lt;body&gt;

    &lt;div class="navbar navbar-inverse navbar-fixed-top"&gt;
      &lt;div class="navbar-inner"&gt;
        &lt;div class="container-fluid"&gt;
          &lt;a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"&gt;
            &lt;span class="icon-bar"&gt;&lt;/span&gt;
            &lt;span class="icon-bar"&gt;&lt;/span&gt;
            &lt;span class="icon-bar"&gt;&lt;/span&gt;
          &lt;/a&gt;
          &lt;a class="brand" href="#"&gt;Project name&lt;/a&gt;
          &lt;div class="nav-collapse collapse"&gt;
            &lt;p class="navbar-text pull-right"&gt;
              Logged in as &lt;a href="#" class="navbar-link"&gt;Username&lt;/a&gt;
            &lt;/p&gt;
            &lt;ul class="nav"&gt;
                &lt; // loop over each page created in the global to create the li's for the navigation &gt;
		&lt;?php foreach ( $PAGE_ARRAY as $page ) : ?&gt;
		&lt;li&lt;?php echo ( PAGE_TO_SERVE == $page ) ? ' class="active"' : ''; ?&gt;&gt;&lt;a href="&lt;?php echo ( $page == 'home' ) ? '/' : '/' . $page . '/'; ?&gt;"&gt;&lt;?php echo ucfirst( $page ); ?&gt;&lt;/a&gt;&lt;/li&gt;
		&lt;?php endforeach; ?&gt;
            &lt;/ul&gt;
          &lt;/div&gt;&lt;!--/.nav-collapse --&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;?
}

function display_footer() {
	
	load_javascript();
	?&gt;
	&lt;div class="container" id="footer"&gt;
		&lt;p&gt;&lt;?php echo date( 'Y' ); ?&gt;&lt;/p&gt;
	&lt;/div&gt;
	&lt;/body&gt;
&lt;/html&gt;
&lt;?php
}
</pre>
<p>So there are two functions in there that output the CSS and Javascript.  My code uses Minify to server as few requests as possible.</p>
<pre class="prettyprint linenums language-php">
function load_css() {

	$css = array(
		'/css/bootstrap.css',
		'/css/bootstrap-responsive.css',
		'/css/application.css'
	);
	?&gt;
	&lt;link id="template-styles" rel="stylesheet" media="all" href="/inc/min/index.php?f=&lt;?php echo implode( ',', $css ); ?&gt;"&gt;
	&lt;?php
	
}

function load_javascript() {
	
	$javascript = array( 
		'/js/jquery.js',
		'/js/bootstrap.js',
		'/js/scripts.js'
	);
	?&gt;&lt;script id="template-scripts" src="/inc/min/index.php?f=&lt;?php echo implode( ',', $javascript ); ?&gt;"&gt;&lt;/script&gt;
	&lt;?php
}
</pre>
<p>Now that we have the main php library of of functions written, we can attack the index.php file at the root that controls what template to serve.  This file will serve template files within a &#8220;view&#8221; folder.  Your urls will not show the &#8220;view&#8221;, it is just a folder where to store the templates.</p>
<pre class="prettyprint linenums language-php">
&lt;?php
// go and get the functions file
require $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.php';

// declare the page array global
global $PAGE_ARRAY;

// if there is a page to serve then we need to figure out which one
if ( PAGE_TO_SERVE ) :
        // before we just go and serve anything we want to make sure that the page exists and is in the array of defined pages
	if ( in_array( PAGE_TO_SERVE, $PAGE_ARRAY ) ) :
                // if it is, then we can go to the view folder and grab the file that bears the same name
		require $_SERVER['DOCUMENT_ROOT'] . '/view/' . PAGE_TO_SERVE . '.php';
	else :
                // otherwise serve the 404 page from the view folder
		require $_SERVER['DOCUMENT_ROOT'] . '/view/404.php';	
	endif;	
else :
        // if there is no page to serve, then we are on the homepage.  in this case go get the "home.php" file
	require $_SERVER['DOCUMENT_ROOT'] . '/view/home.php';
endif;
?&gt;	
</pre>
<p>So now here is an example of a template file.  It calls the <code>display_header()</code> and <code>display_footer()</code> functions</p>
<pre class="prettyprint linenums language-php">
&lt;?php display_header(); ?&gt;

	&lt;div class="container-fluid"&gt;
		&lt;div class="row-fluid"&gt;
			&lt;div class="span3"&gt;
				&lt;!-- Sidebar here --&gt;
			&lt;/div&gt;
			&lt;div class="span3"&gt;
				&lt;!-- Static Content Here --&gt;
			&lt;/div&gt;
		&lt;/div&gt;
        &lt;/div&gt;

&lt;?php display_footer(); ?&gt;
</pre>
<p>That&#8217;s it!  You can definitely go ahead and create a <code>display_sidebar()</code> function, or anything else you need and just place it in the functions.php file.</p>
<p><a href="https://github.com/matthewaprice/Static-Site-Template-Engine" class="btn">Download source files from GitHub Repository</a></p>
]]></content:encoded>
			<wfw:commentRss>http://matthewaprice.com/static-website-template-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>U Choose Slider Plugin</title>
		<link>http://matthewaprice.com/u-choose-slider-plugin/</link>
		<comments>http://matthewaprice.com/u-choose-slider-plugin/#comments</comments>
		<pubDate>Mon, 31 Dec 2012 23:09:03 +0000</pubDate>
		<dc:creator>Matthew Price</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wordpress plugins]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[slider management]]></category>

		<guid isPermaLink="false">http://matthewaprice.com/?p=1897</guid>
		<description><![CDATA[<p>This is a WordPress plugin I wrote that stores information about slider images in the database. &#160;It also gives you a template tag that you can use to loop over the images and implement your own JS Slider in your theme. &#160;It has a management page in the wp-admin dashboard so that you can add a title, description, link to follow, image url, and the ability to make it active or inactive.</p>
]]></description>
				<content:encoded><![CDATA[<p>This is a WordPress plugin I wrote that stores information about slider images in the database.  It also gives you a template tag that you can use to loop over the images and implement your own JS Slider in your theme.  It has a management page in the wp-admin dashboard so that you can add a title, description, link to follow, image url, and the ability to make it active or inactive.</p>
<p>On the Github repo there are examples of how to implement this plugin with both jQuery Cycle and Twitter Bootstrap Carousel.  All this does is store data, so it should in theory work with ANY slider script.  </p>
<p>Here is the link to the repo: <a href="https://github.com/matthewaprice/U-Choose-Slider">Github Repo</a></p>
<p>The plugin is in use on the following sites:<br />
<a href="http://sustainablelivingassociation.org">Sustainable Living Association</a> (jQuery Cycle)<br />
<a href="http://belocalnc.org">Be Local Northern Colorado</a> (Twitter Bootstrap Carousel)</p>
<p><em>Note: If you find any issues or have any questions, please leave a comment at the bottom of the post.<br />
</em></p>
<h4>Here is the Twitter Bootstrap Carousel Example:</h4>
<pre class="prettyprint linenums language-php">
&lt;script&gt;
jQuery(document).ready(function() {
    jQuery('.carousel').carousel(); 
});
&lt;/script&gt;

&lt;div id="my_carousel" class="carousel slide"&gt;
    &lt;div class="carousel-inner"&gt;
        &lt;?php $slider_images = get_ucs_slider_images(); ?&gt;
        &lt;?php
        $i = 0 ;
        foreach ( $slider_images as $img ) : ?&gt;
        &lt;div class="&lt;?php echo ( $i == 0 ) ? 'active ' : ''; ?&gt;item"&gt;
            &lt;a href="&lt;?php echo $img-&gt;slider_link; ?&gt;"&gt;
            &lt;img src="&lt;?php echo $img-&gt;slider_image; ?&gt;"&gt;
            &lt;div class="carousel-caption"&gt;
                &lt;h4&gt;&lt;?php echo $img-&gt;slider_title; ?&gt;&lt;/h4&gt;
                &lt;p&gt;&lt;?php echo $img-&gt;slider_description; ?&gt;&lt;/p&gt;
            &lt;/div&gt;
            &lt;/a&gt;
        &lt;/div&gt;
        &lt;?php $i++; endforeach; ?&gt;
    &lt;/div&gt;
    &lt;a class="carousel-control left" href="#my_carousel" data-slide="prev"&gt;‹&lt;/a&gt;
    &lt;a class="carousel-control right" href="#my_carousel" data-slide="next"&gt;›&lt;/a&gt;
&lt;/div&gt; 
</pre>
<h4>Here are some screenshots</h4>
<p><h4>Adding a new slider to the db</h4>
<p><img src="http://i1.wp.com/matthewaprice.com/assets/uchoose1.png" data-recalc-dims="1">
</p>
<p><h4>Listing of Active Slider Images</h4>
<p><img src="http://i0.wp.com/matthewaprice.com/assets/uchoose2.png" data-recalc-dims="1">
</p>
<p><h4>Editing a Slider Image</h4>
<p><img src="http://i0.wp.com/matthewaprice.com/assets/uchoose3.png" data-recalc-dims="1">
</p>
<p><h4>Inactive Slider Images show up in a separate table below the Active Slider Images</h4>
<p><img src="http://i0.wp.com/matthewaprice.com/assets/uchoose4.png" data-recalc-dims="1"></p>
]]></content:encoded>
			<wfw:commentRss>http://matthewaprice.com/u-choose-slider-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stream Phish iPhone App to AppleTV</title>
		<link>http://matthewaprice.com/stream-phish-iphone-app-to-appletv/</link>
		<comments>http://matthewaprice.com/stream-phish-iphone-app-to-appletv/#comments</comments>
		<pubDate>Sat, 29 Dec 2012 21:01:35 +0000</pubDate>
		<dc:creator>Matthew Price</dc:creator>
				<category><![CDATA[AppleTV]]></category>
		<category><![CDATA[appletv]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[phish]]></category>
		<category><![CDATA[stream]]></category>

		<guid isPermaLink="false">http://matthewaprice.com/?p=1889</guid>
		<description><![CDATA[<p>As far as I can tell, there is no setting in the app to send audio to an AppleTV. &#160;However!</p>
<p>I was watching a couple of YouTube videos from my iPhone streamed to the AppleTV. &#160;I then went to the Phish App to listen to last night's MSG Show. &#160;To my surprise it started playing through the AppleTV. &#160;I tested this and realized that after choosing the output from the YouTube App to be the Apple TV, that it then became the default output for the Phish App and voil&#224;!</p>
<p>I know this has nothing to do with web development, but this is a trick i deemed important to share.&#160;</p>
<p>&#160;</p>
<p>Enjoy!</p>
]]></description>
				<content:encoded><![CDATA[<p>As far as I can tell, there is no setting in the app to send audio to an AppleTV.  However!</p>
<p>I was watching a couple of YouTube videos from my iPhone streamed to the AppleTV.  I then went to the Phish App to listen to last night&#8217;s MSG Show.  To my surprise it started playing through the AppleTV.  I tested this and realized that after choosing the output from the YouTube App to be the Apple TV, that it then became the default output for the Phish App and voilà!</p>
<p>I know this has nothing to do with web development, but this is a trick i deemed important to share. </p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://matthewaprice.com/stream-phish-iphone-app-to-appletv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reduce the number of requests in your WordPress theme</title>
		<link>http://matthewaprice.com/reduce-the-number-of-requests-in-your-wordpress-theme/</link>
		<comments>http://matthewaprice.com/reduce-the-number-of-requests-in-your-wordpress-theme/#comments</comments>
		<pubDate>Sat, 22 Dec 2012 17:32:06 +0000</pubDate>
		<dc:creator>Matthew Price</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[minify]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://matthewaprice.com/?p=1868</guid>
		<description><![CDATA[<p>This simple code will allow you to load all of your themes css files into one request without a plugin. &#160;I have not yet found a plugin that works with other plugins nicely as not all plugin authors play by the rules when enqueueing scripts and styles. &#160;So i figured that I would start with my theme. &#160;I wrote my own theme for this site based on the <a href="http://twitter.github.com/bootstrap/" target="_blank">Twitter Bootstrap</a>. &#160;On its own, there would be a request for the bootstrap css file and one custom one for my theme. &#160;And the javascripts would be one for the bootstrap and one for my custom js.</p>
]]></description>
				<content:encoded><![CDATA[<p>This simple code will allow you to load all of your themes css files into one request without a plugin.  I have not yet found a plugin that works with other plugins nicely as not all plugin authors play by the rules when enqueueing scripts and styles.  So i figured that I would start with my theme.  I wrote my own theme for this site based on the <a href="http://twitter.github.com/bootstrap/" target="_blank">Twitter Bootstrap</a>.  On its own there would be a request for the bootstrap css file and one custom one for my theme.  And the javascripts would be one for the bootstrap and one for my custom js.</p>
<p>Add to this that I use <a href="http://code.google.com/p/google-code-prettify/" target="_blank">Prettify</a> for my syntax highlighting and you can see that the requests can start to pile up.  Let&#8217;s say that your theme also uses modernizr, jquery ui, maybe a slider script, etc&#8230; it is easy to see that the js and css requests can really start to add up.</p>
<p>Let&#8217;s start with the minifier.  I use <a href="http://code.google.com/p/minify/" target="_blank">Minify</a> for this task.  It is really easy to use and install.  Just copy the min folder to the root of your theme.  For this demo, you do not have to do any modification to the sources files.  Then you can place the following snippets into your theme&#8217;s functions.php file to register and enqueue your scripts.  In my case, I wanted to load jQuery from the theme as I often find that upgrades to jQuery break some code and this will mean that all my existing code will work even if WordPress upgrades its version.</p>
<p>You can view the source/inspect element on this page and see these two requests on my site.  They will look like:</p>
<pre class="prettyprint linenums language-html">
&lt;link rel="stylesheet" id="theme_styles-css" href="http://matthewaprice.com/wp-content/themes/hendrix/min/index.php?f=%2Fwp-content%2Fthemes%2Fhendrix%2Fcss%2Fbootstrap.css%2C%2Fwp-content%2Fthemes%2Fhendrix%2Fcss%2Fprettify.css%2C%2Fwp-content%2Fthemes%2Fhendrix%2Fstyle.css&amp;ver=3.5" type="text/css" media="all"&gt;
</pre>
<p>AND</p>
<pre class="prettyprint linenums language-html">
&lt;script type='text/javascript' src='http://matthewaprice.com/wp-content/themes/hendrix/min/index.php?f=%2Fwp-content%2Fthemes%2Fhendrix%2Fjs%2Fbootstrap.min.js%2C%2Fwp-content%2Fthemes%2Fhendrix%2Fjs%2Fprettify.js%2C%2Fwp-content%2Fthemes%2Fhendrix%2Fjs%2Fscripts.js&#038;ver=3.5'&gt;&lt;/script&gt;
</pre>
<p>Here is the code for your functions.php</p>
<pre class="prettyprint linenums language-php">

add_action( 'init', 'map_register_scripts_styles' );
add_action( 'wp_enqueue_scripts', 'map_enqueue_scripts_styles' );

function map_register_scripts_styles() {
  // so the minifier needs relative urls, not with the full http://
  // this grabs the theme location dynamically and then parses the url so that we can end up with "/wp-content/themes/theme_folder"
  $template_location = parse_url( get_bloginfo( 'template_directory' ) );

  if ( !is_admin() ) {
    // if we are on the front end, deregister the default jquery and register my own
    wp_deregister_script( 'jquery' );
    wp_register_script( 'theme_jquery', $template_location['path'] . '/js/jquery-1.8.3.min.js' );
  }
  
  // create an array of css files to add to the minified request	
  $theme_styles = array(
    $template_location['path'] . '/css/bootstrap.min.css',
    $template_location['path'] . '/css/prettify.css',
    $template_location['path'] . '/style.css'
  );
  wp_register_style( 'theme_styles', $template_location['path'] . '/min/index.php?f=' . implode( ',', $theme_styles ) );
	  	
  // create an array of javascript files to add to the minified request
  $theme_scripts = array(
    $template_location['path'] . '/js/bootstrap.min.js',
    $template_location['path'] . '/js/prettify.js',
    $template_location['path'] . '/js/scripts.js'
  );
  wp_register_script( 'theme_scripts', $template_location['path'] . '/min/index.php?f=' . implode( ',', $theme_scripts ), array( 'theme_jquery' ), '', true );  		
	
}

function map_enqueue_scripts_styles() {

  wp_enqueue_script( 'theme-jquery' );
  wp_enqueue_script( 'theme_scripts' );	
  wp_enqueue_style( 'theme_styles' );
		
}
</pre>
<p>So you can see that at least your theme&#8217;s styles and scripts will be loaded with one request a piece.  </p>
<p>Note:  the minifier will not perform any compression on a file with &#8220;.min&#8221; on it.  So you are just including it so that all the scripts can be included with one request.  This is by no means perfect, but it works on this site and where there once were 6 requests, there are now only 2.  I am working on a way that would register a script to a global that could then be accessed from a theme so that my plugin&#8217;s scripts and styles could be merged with the array that I use in my theme to register styles and scripts and really reduce the number of requests.  </p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://matthewaprice.com/reduce-the-number-of-requests-in-your-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Revised Most Commented Post Plugin</title>
		<link>http://matthewaprice.com/revised-most-commented-post-plugin/</link>
		<comments>http://matthewaprice.com/revised-most-commented-post-plugin/#comments</comments>
		<pubDate>Thu, 26 Jul 2012 19:24:00 +0000</pubDate>
		<dc:creator>Matthew Price</dc:creator>
				<category><![CDATA[wordpress plugins]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[popular]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://matthewaprice.com/?p=1711</guid>
		<description><![CDATA[<p><a href="http://matthewaprice.com/wordpress-most-commented-post-plugin/" target="_blank">Awhile back</a>, I created a plugin that would allow you to put a template tag on your site to display popular posts based on the number of comments on posts. It was quick, dirty and not the best code I have ever written.</p>
<p>I have completely rebuilt it using the WordPress Widget system so you can add it to your sidebar via the Widgets Administration panel.</p>
<p>This widget works based on the number of comments on your posts. It takes the most commented post and gives it a value of 1. You can then pick up to three levels to compare the other number of comments per post. You can also pick the number of posts to display in your sidebar.</p>
]]></description>
				<content:encoded><![CDATA[<p><a href="http://matthewaprice.com/wordpress-most-commented-post-plugin/" target="_blank">Awhile back</a>, I created a plugin that would allow you to put a template tag on your site to display popular posts based on the number of comments on posts. It was quick, dirty and not the best code I have ever written.</p>
<p>I have completely rebuilt it using the WordPress Widget system so you can add it to your sidebar via the Widgets Administration panel.</p>
<p>This widget works based on the number of comments on your posts. It takes the most commented post and gives it a value of 1. You can then pick up to three levels to compare the other number of comments per post. You can also pick the number of posts to display in your sidebar.</p>
<p>So basically, if you select levels of 0.6, 0.3, and 0.1, then the posts that are above 0.6 and below 1 will be listed and assigned a CSS Class of &#8220;fire&#8221;. The ones between 0.3 and 0.6 will me assigned &#8220;medium&#8221;. The next level will be &#8220;medium&#8221; and the last will be &#8220;mild&#8221;</p>
<p>This will allow you to use CSS in your theme to style the posts and create a sort of &#8220;heat map&#8221;. You could assign the fire level to be red, medium to be orange, etc.</p>
<p>This is used in my sidebar, although i do not differentiate based on color. If you inspect the &#8220;popular posts&#8221; in the sidebar, the CSS classes are still there.</p>
<p>I find that this is a useful way to display popular posts&#8230;whatever people are talking about the most should be a good metric for what is popular.</p>
<p>You can view the code and download it here:</p>
<p><a href="https://github.com/matthewaprice/WordPress-Most-Commented-Posts-Widget" target="_blank">https://github.com/matthewaprice/WordPress-Most-Commented-Posts-Widget</a></p>
<p><a href="http://i2.wp.com/matthewaprice.com/assets/Screen-Shot-2012-07-26-at-1.25.21-PM.png"><img class="size-full wp-image-1716 alignleft" title="Screen Shot 2012-07-26 at 1.25.21 PM" src="http://i1.wp.com/matthewaprice.com/assets/Screen-Shot-2012-07-26-at-1.25.21-PM.png?resize=263%2C469" alt="" data-recalc-dims="1" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://matthewaprice.com/revised-most-commented-post-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OS X Mountain Lion First Look</title>
		<link>http://matthewaprice.com/os-x-mountain-lion-first-look/</link>
		<comments>http://matthewaprice.com/os-x-mountain-lion-first-look/#comments</comments>
		<pubDate>Wed, 25 Jul 2012 16:51:32 +0000</pubDate>
		<dc:creator>Matthew Price</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[mountain lion]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://matthewaprice.com/?p=1701</guid>
		<description><![CDATA[<p>Here's a quick overview of my first impressions of OS X Mountain Lion.  Full article contains descriptions of Notification Center, Safari, The Dock, and Notes</p>
]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s a quick overview of my first impressions of OS X Mountain Lion.</p>
<p><strong>Notification Center</strong><br />
The notification center is great.  Really nice to have this built in on an OS level.  I booted up mail and within minutes, I was notified of a new piece of mail and I very naturally used the banner notification and clicked through to the email. </p>
<p><strong>Safari</strong><br />
Safari now finally has the SSL notification IN the URL bar.  Putting the lock as a missable icon in the upper right as before was not very helpful.</p>
<p>I love the new iCloud tabs.  That is going to be very handy as I have a MacPro, MacBook, and iPhone.</p>
<p>I also like the dynamically sized tabs.  By default, if you have one tab it takes up the entire width of the browser and as you add them, they get smaller.</p>
<p>The share button is also quite nice.  I really like one click options to do common tasks.</p>
<p>The tab browser is DOPE.  The full sized previews are really awesome and make identifying tabs super easy.</p>
<p><strong>The Dock</strong><br />
I was annoyed that Launchpad was put back into my dock. ^_^ But i really like the new subdued dock indicators.  They are smaller and more square.  Aesthetically, I just like them more.  The overall appearance is softer and smoother.  </p>
<p><strong>Notes</strong><br />
As someone who uses these often and I place my notes onto different IMAP accounts, this is nice to have a dedicated app to consolidate them and make them easy to find and update.</p>
<p><strong>Messages</strong><br />
So you can now adjust your status directly from a tabbed chat window.  That is nice to not have to go and find the buddy list to adjust.  And you can also adjust your status on per account level from the chat window too.</p>
<p>As I find new cool features/updates, I will post them here</p>
]]></content:encoded>
			<wfw:commentRss>http://matthewaprice.com/os-x-mountain-lion-first-look/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Community Funded Update</title>
		<link>http://matthewaprice.com/community-funded-update/</link>
		<comments>http://matthewaprice.com/community-funded-update/#comments</comments>
		<pubDate>Mon, 18 Jun 2012 17:14:52 +0000</pubDate>
		<dc:creator>Matthew Price</dc:creator>
				<category><![CDATA[Community Funded]]></category>
		<category><![CDATA[community funded]]></category>
		<category><![CDATA[crowd source]]></category>

		<guid isPermaLink="false">http://matthewaprice.com/?p=1652</guid>
		<description><![CDATA[<p>I would like to take this opportunity to explain some of the cool features and projects that are on Community Funded.  For a little background, I have been working on this site since I was brought in as a consultant in August, and became the Director of Development in November.  The website is a <a href="http://en.wikipedia.org/wiki/Crowd_funding" target="_blank">crowd funding</a> website that takes advantage of the power of Mega Community Collaboration (MC2).  Here is what this about: MC² happens when motivated groups of individuals and organizations focus on common goals to maximize their community’s resources. Modern technology allows for the connection of many diverse communities to form <em>The Community –</em> which possesses all the resources and funds needed to make incredible things happen. Community Funded will transform this potential into energy through the power of MC² .</p>
]]></description>
				<content:encoded><![CDATA[<p>I would like to take this opportunity to explain some of the cool features and projects that are on Community Funded.  For a little background, I have been working on this site since I was brought in as a consultant in August, and became the Director of Development in November.  The website is a <a href="http://en.wikipedia.org/wiki/Crowd_funding" target="_blank">crowd funding</a> website that takes advantage of the power of Mega Community Collaboration (MC2).  Here is what this about: MC² happens when motivated groups of individuals and organizations focus on common goals to maximize their community’s resources. Modern technology allows for the connection of many diverse communities to form <em>The Community –</em> which possesses all the resources and funds needed to make incredible things happen. Community Funded will transform this potential into energy through the power of MC² .</p>
<p>The website has some really innovative features that separate us from some of the other crowd funding websites.</p>
<p><strong>Giftbacks<br />
</strong>While other sites bind you to a funding level, our site works more like E-Commerce.  We allow our Project Creators to offer items at a minimum pledge level.  So a project can offer items &#8220;piece-meal&#8221; which are normally part of levels on other sites.  A project can offer, for example, a Tee Shirt, A Shout Out, Tickets to Exclusive Events, Music Lessons, Gift Cards, Pint Glasses, etc.  There is no limit to what a Project Creator can offer.  This allows a member to do some cool things.  The first being, you can go from project to project adding Giftbacks to your Giftbasket (think shopping cart), and pick and choose what you want in return for your pledge to the project.  What this then allows you to do is <strong>fund multiple projects at one time!  </strong>You can swipe your credit card once and fund many projects at one time.  This is a really cool advantage to using our site.</p>
<p>We take this to another level with our ability to Explore for Giftbacks.  If you are either undecided about what project to support or just want some cool shwag and just want to make your community stronger, you can just <a href="http://communityfunded.com/explore-giftbacks/" target="_blank">browse for the Giftbacks</a> that projects are offering.  You can then check out and voila, you have supported projects and your community.</p>
<p><strong>Non-Profits<br />
</strong>Most crowd funding websites are dedicated to normal threshold style pledging (project creator has to raise a certain amount of money in a given time to get the funds).  There are some other types of sites that are dedicated to fundraising for not for profit companies, our site allows for <strong>both styles.  </strong>We have a proprietary system in place that allows you to fund both types of projects in your Gift-Basket at once!  The monies pledged to not for profit projects go directly to the organization.  You get an email receipt that you can use as your tax deduction where appropriate.  So not for profit projects have a goal, but they get whatever is pledged. They still have a time frame, but it is not threshold style pledging.  Being able to tap into the not for profit networks means we are able to gain access to the people who are used to giving and then they become exposed to the normal projects.</p>
<p><strong>Matched Funding<br />
</strong>We have a great system in place that allows for our members who are inspired by a project to offer matched funding.  This is fun and makes the site more powerful.  So when an organization or individual offers to match funds, a standard pledge that comes in is worth more!  If a project is being matched for $5,000 and you make a pledge, your efforts are worth 2x.  And a project can have more than one matcher, so your pledge can be worth 2x,3x,4x, or more.</p>
<p><strong>More coming soon&#8230;<br />
</strong>We are working on some more amazing features that will empower our communities and make this an even better tool.</p>
<p>Here are some links to check out on the site</p>
<p><a href="http://communityfunded.com/explore-projects/" target="_blank">http://communityfunded.com/explore-projects/</a><br />
<a href="http://communityfunded.com/explore-giftbacks/" target="_blank">http://communityfunded.com/explore-giftbacks/</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://matthewaprice.com/community-funded-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with WordPress Transients</title>
		<link>http://matthewaprice.com/fun-with-wordpress-transients/</link>
		<comments>http://matthewaprice.com/fun-with-wordpress-transients/#comments</comments>
		<pubDate>Sun, 10 Jun 2012 14:36:33 +0000</pubDate>
		<dc:creator>Matthew Price</dc:creator>
				<category><![CDATA[content filtering]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[transients]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://matthewaprice.com/?p=1558</guid>
		<description><![CDATA[<p>It has been awhile since I have written, but I wanted to detail how and when to use WordPress transients. First off, what are transients? WordPress has a great API for storing data that might be either the results of an expensive/complex query, or data that does not change that often. The rationale behind these is to make the pages load faster without having to do the expensive queries for every user that visits your site. They offer us an expiration date so that the data can be regenerated on a schedule.</p>
<p>I have two examples in the full article for you to review. Hopefully they will help you make your site more efficient.</p>
]]></description>
				<content:encoded><![CDATA[<p>It has been awhile since I have written, but I wanted to detail how and when to use WordPress transients. First off, what are transients? WordPress has a great API for storing data that might be either the results of an expensive/complex query, or data that does not change that often. The rationale behind these is to make the pages load faster without having to do the expensive queries for every user that visits your site. They offer us an expiration date so that the data can be regenerated on a schedule.</p>
<p>Let&#8217;s say that you have a site displays posts after filtering by custom fields and categories. In order to perform this filter, there are a number of table joins that have to occur to generate the posts that meet the criteria. Transients are great because they give us the ability to store the results of the query in the options table for quick and easy retrieval. Once you set a transient value, a site visitor will retrieve that data as opposed to doing all of the database heavy lifting. If you put an expiration of 10 minutes on the data and you have 1000 visitors an hour coming to your site, that means that only 6 people will actually have to do the query from scratch.</p>
<p>I will go through a couple of different examples below</p>
<pre class="prettyprint linenums language-php">&lt;?php

// first a simple query to demonstrate how this works
// let's create a function that will return the transient for future use
function get_my_favorite_books() {

	// first try to go and get the transient
	$favorite_books = get_transient( 'favorite_books' );

	// then we check to see if the transient is there
	if ( !$favorite_books ) {

		// if it is not there, or has expired, then we can go and build the results
		$query_args = array(
			'post_type' =&gt; 'post',
			'tag' 		=&gt; 'favorite-books'
		);

		$results = new WP_Query( $query_args );

		// now that we have the results we can store this in the transient for later retrieval
		// the arguments are " 'transient_name', $data_to_store, 'expiration date in seconds' )
		set_transient( 'favorite_books', $results, 3600 );
		$favorite_books = get_transient( 'favorite_books' );

	}

	// now we can return the results.
	// if the transient was there in the beginning, then we are just returning the original reference to $favorite_books,
	// otherwise we are returning the freshly set transient
	return $favorite_books;

}

// now you can call this function like this....
$favorite_books = get_my_favorite_books();
// now since this was a WP_Query object, we can do a regular loop
if ( $favorite_books-&gt;have_posts() ) : while ( $favorite_books-&gt;have_posts() ) : $favorite_books-&gt;the_post(); global $post;
?&gt;
	&lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
	&lt;div class="post_tags"&gt;&lt;?php the_tags(); ?&gt;&lt;/div&gt;
	&lt;div class="post_content"&gt;&lt;?php the_content(); ?&gt;&lt;/div&gt;

&lt;?php
endwhile; endif;</pre>
<p>now let&#8217;s try a more complicated query to see the real power of why these are really great</p>
<pre class="prettyprint linenums language-php">&lt;?php
function get_complex_query_results() {

	// first try to go and get the transient
	$complex_query_results = get_transient( 'complex_query_results' );

	// then we check to see if the transient is there
	if ( !$complex_query_results ) {

		// if it is not there, or has expired, then we can go and build the results
		$query_args = array(
			'post_type' =&gt; 'my-custom-post-type',
			'tax_query' =&gt; array(
				'relation' =&gt; 'OR',
				array(
					'taxonomy' =&gt; 'my-custom-taxonomy',
					'field'    =&gt; 'slug',
					'terms'	   =&gt; array( 'my-term-1', 'my-term-2' )
				),
				array(
					'taxonomy' =&gt; 'my-other-custom-taxonomy',
					'field'    =&gt; 'slug',
					'terms'	   =&gt; array( 'my-other-term-1', 'my-other-term-2' )
				)				
			),
			'meta_query' =&gt; array(
				array(
					'key' 	  =&gt; 'price',
					'value'   =&gt; array( '100','1000' ),
					'type'    =&gt; 'numeric',
					'compare' =&gt; 'BETWEEN'
				)
			),
			'orderby' =&gt; 'title',
			'order'	  =&gt; 'ASC'
		);

		$results = new WP_Query( $query_args );

                // One cool use of this is that you can feed in POST or GET variables into the query_args and cache search results
                // you could use the search query as the transient and then look for that transient.
                // if the transient exists, then someone else has performed the same search.  
                // why do the query if someone else already has?

		// now that we have the results we can store this in the transient for later retrieval
		// the arguments are " 'transient_name', $data_to_store, 'expiration date in seconds' )
		set_transient( 'complex_query_results', $results, 86400 );
		$complex_query_results = get_transient( 'complex_query_results' );

	}

	// now we can return the results.
	// if the transient was there in the beginning, then we are just returning the original reference to $complex_query_results,
	// otherwise we are returning the freshly set transient
	return $complex_query_results;	

}

// now you can call this function like this....
$complex_query_results = get_complex_query_results();
// now since this was a WP_Query object, we can do a regular loop
if ( $complex_query_results-&gt;have_posts() ) : while ( $complex_query_results-&gt;have_posts() ) : $complex_query_results-&gt;the_post(); global $post;
?&gt;
	&lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;
	&lt;div class="post_content"&gt;&lt;?php the_content(); ?&gt;&lt;/div&gt;

&lt;?php
endwhile; endif;
?&gt;</pre>
<p>Now let&#8217;s say that you only write a new article that would be displayed by the complex query once a week. Why should every user be getting the results by performing the query? With the complex example, the transient will live for 1 day. So over the course of a day, only one user will be actually doing the database heavy lifting.</p>
<p>I hope this helps you out and will make your blog or site more efficient. These are very helpful and should be used to eliminate excess database queries.</p>
<p>For more information, view the <a href="http://www.wpkube.com/" target="_blank">Transients API on the WordPress Codex</a></p>
]]></content:encoded>
			<wfw:commentRss>http://matthewaprice.com/fun-with-wordpress-transients/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Community Funded</title>
		<link>http://matthewaprice.com/community-funded/</link>
		<comments>http://matthewaprice.com/community-funded/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 21:40:26 +0000</pubDate>
		<dc:creator>Matthew Price</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[crowd source]]></category>
		<category><![CDATA[funding]]></category>

		<guid isPermaLink="false">http://matthewaprice.com/?p=1317</guid>
		<description><![CDATA[<p>So I have been working on a project that has become my main focus.  I am really proud to be the developer for <a href="http://www.communityfunded.com">www.communityfunded.com</a>.  We currently have a splash page up that allows the public to register as a user.  </p>
<p>Here is a brief summary of the project:</p>
<p><em>Community Funded will connect people, ideas and resources in historic new ways, empowering our communities and promoting "grass-roots economic recovery." Anything’s possible when it’s Community Funded.</em></p>
<p>Please sign up to be a part of something really special.</p>
<p>Here is a link to our Facebook page with some more info and response from the public: <a href="https://www.facebook.com/CommunityFunded">https://www.facebook.com/CommunityFunded</a></p>
]]></description>
				<content:encoded><![CDATA[<p>So I have been working on a project that has become my main focus.  I am really proud to be the developer for <a href="http://www.communityfunded.com">www.communityfunded.com</a>.  We currently have a splash page up that allows the public to register as a user.  </p>
<p>Here is a brief summary of the project:</p>
<p><em>Community Funded will connect people, ideas and resources in historic new ways, empowering our communities and promoting &#8220;grass-roots economic recovery.&#8221; Anything’s possible when it’s Community Funded.</em></p>
<p>Please sign up to be a part of something really special.</p>
<p>Here is a link to our Facebook page with some more info and response from the public: <a href="https://www.facebook.com/CommunityFunded">https://www.facebook.com/CommunityFunded</a></p>
]]></content:encoded>
			<wfw:commentRss>http://matthewaprice.com/community-funded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keep Users Based On Role Out of WP-ADMIN</title>
		<link>http://matthewaprice.com/keep-users-based-on-role-out-of-wp-admin/</link>
		<comments>http://matthewaprice.com/keep-users-based-on-role-out-of-wp-admin/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 14:36:11 +0000</pubDate>
		<dc:creator>Matthew Price</dc:creator>
				<category><![CDATA[tips]]></category>
		<category><![CDATA[users]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://matthewaprice.com/?p=1303</guid>
		<description><![CDATA[<p>Here is a quick and dirty way to keep your users out of the WP-ADMIN area.  I have not found a good way to redirect a user from the wp-login.php page to a custom page and not profile.php. (anyone knows, please let me know : &#38;gt; ). I needed this as i had a front end system for users to manage their profiles.  That part needed to look like the regular theme and not like the admin area.</p>
]]></description>
				<content:encoded><![CDATA[<p>Here is a quick and dirty way to keep your users out of the WP-ADMIN area.  I have not found a good way to redirect a user from the wp-login.php page to a custom page and not profile.php. (anyone knows, please let me know : &gt; ). I needed this as i had a front end system for users to manage their profiles.  That part needed to look like the regular theme and not like the admin area.</p>
<p>This code can be placed in your theme&#8217;s functions.php or in a plugin.  You can replace &#8220;administrator&#8221; with any role that you choose.</p>
<pre class="prettyprint linenums language-php">
function wp_admin_role_limiter() {
     if ( ( is_user_logged_in() ) &#038;&#038; ( preg_match( '/wp-admin/', $_SERVER['REQUEST_URI'] ) ) ) {
          if ( !current_user_can( 'administrator' ) ) {
	       header( 'Location: http://www.domain.com/custom-profile-page/' );
	  }
     }
}
add_action( 'admin_head', 'wp_admin_role_limiter' );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://matthewaprice.com/keep-users-based-on-role-out-of-wp-admin/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
