<?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 WinkleAdd tag-like functionality to your pod inputs | Mike Van Winkle</title>
	<atom:link href="http://www.mikevanwinkle.com/tag/pods/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikevanwinkle.com</link>
	<description>Wordpress/PHP Developer</description>
	<lastBuildDate>Tue, 31 Jan 2012 00:02:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Add tag-like functionality to your pod inputs</title>
		<link>http://www.mikevanwinkle.com/wordpress/add-tag-like-functionality-to-your-pod-inputs/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/add-tag-like-functionality-to-your-pod-inputs/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 16:02:30 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[Pods]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[helpers]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[podscms]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress How To]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=911</guid>
		<description><![CDATA[This pseudo-tutorial guides you through setting up a nifty helper for your WordPress pods. The helper emulates the native WordPress tag entry but applies it to whatever content type you specify. ]]></description>
			<content:encoded><![CDATA[<p><strong>Yet another update:</strong> The code below expects the name of your pick field to correspond to the name of the related pod type ( i.e. a pickfield name &#8220;genre&#8221; should relate to a pod called &#8220;genre&#8221; , as opposed to &#8220;file_type&#8221;).</p>
<p><strong><em>Warning: </em> My code highlighter is gimping up the code a little. If you plan to copy/paste, please <a href="http://www.mikevanwinkle.com/wp-content/uploads/2011/04/pods-tag-input.txt">download the text file</a> instead of copying straight from the webpag.</strong> </p>
<p><a href="http://mikevanwinkle.com/sandbox/wp/wp-admin/admin.php?page=pods-manage-books">Try the DEMO</a><br />
(login using guest/guest).</p>
<p><strong>Update: </strong>The demo was down yesterday because I was playing with some code. Sorry about that.</p>
<p><strong>Update 2: </strong><br />
Also note that if this input helper isn&#8217;t working on your site make sure that you&#8217;ve enqueued the &#8220;suggest&#8221; script which ships automatically with WordPress. Do this by adding the following line of code to your functions.php file:</p>
<pre class="brush:php">
if (!wp_script_is('suggest', 'queue') &#038;&#038; !wp_script_is('suggest', 'to_do') &#038;&#038; !wp_script_is('suggest', 'done'))  {
        wp_enqueue_script('suggest');
}
</pre>
<p>So this isn&#8217;t really a helper so I&#8217;m not going to add it to the PodsCMS helper gallery. However, I think it&#8217;s a useful bit of code for pods developers.</p>
<p>The problem: You prefer using pods for developing content that needs lots of relationships managed seamlessly. Post types and tags just won&#8217;t cut it. But man, you miss that slick tag UI that WordPress has where you just start typing, hit enter and POW the tag is added. Pods doesn&#8217;t have anything like this natively.</p>
<p>The solution:</p>
<p>First create a new input helper and paste in the following code:</p>
<pre class="brush:php">
<script>
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery('#delete-tag').live('click', function(e) {
	e.preventDefault();
	jQuery(this).parent('span').remove();
});

jQuery('#<?php echo $css_id; ?>').find('input').suggest(ajaxurl+'?action=pods_suggest&#038;datatype=<?php echo $field['name']; ?>'); 

jQuery('#tag-input').click(function(e) {
	e.preventDefault();
	var new_tag = jQuery('#<?php echo $css_id; ?>').find('input').attr('value');
	var datatype = '<?php echo $field['name']; ?>';
	jQuery(this).next('div').append('<span><a href="" id="delete-tag" class="ntdelbutton">x</a> &nbsp; '+new_tag+'
<div class="option active" value="'+new_tag+'" style="display:none;"></div>

</span>');
	jQuery('#<?php echo $css_id; ?>').find('input').attr('value','');
});

jQuery('#<?php echo $css_id; ?>').find('input').keydown(function(event) {
	if (event.keyCode == '13') {
	var new_tag = jQuery('#<?php echo $css_id; ?>').find('input').attr('value');
	jQuery('#<?php echo $name; ?>-output').append('<span><a href="" id="delete-tag" class="ntdelbutton">x</a> &nbsp; '+new_tag+'
<div class="option active" value="'+new_tag+'" style="display:none;"></div>

</span>');
	jQuery('#<?php echo $css_id; ?>').find('input').attr('value','');
	}
});

});
</script>
<div class="<?php echo $css_classes; ?>" id="<?php echo $css_id; ?>" style="height:auto;background:transparent;border:none;">
<input name="<?php echo $name; ?>[]" type="text" class="" id="<?php echo $css_id; ?>" value=""  /><a href="#" id="tag-input" title="Add tag" class="button">
Add</a>
<div id="<?php echo $name; ?>-output" class="tagchecklist <?php echo $name; ?>list">
<?php foreach($value as $val): ?>
<?php if($val['active']): ?>
<span>
<a href="" id="delete-tag" class="ntdelbutton">x</a> &nbsp; <?php echo $val['name']; ?>
<div class="option active" value="<?php echo $val['name']; ?>" style="display:none;"><?php echo $val['name']; ?></div>

</span>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
</pre>
<p>This helper creates an input field and calls up some jQuery magic to make it auto-complete. But in order for this magic to work you need to add a function to your functions.php (or a plugin file if that&#8217;s the case) and hook it to the wp_ajax_{$action} hook. For more about this hook check <a href="http://www.garyc40.com/2010/03/5-tips-for-using-ajax-in-wordpress/">Gary Cao&#8217;s article</a>. </p>
<pre class="brush:php">
add_action('wp_ajax_pods_suggest','ajax_pod_search');
function ajax_pod_search() {
	if(isset($_GET['q'])) {
		$str = $_GET['q'];
		if(strlen($str) < 2) { die; }
			$pod = $_GET['datatype'];
			global $wpdb;
			$query = $wpdb->prepare("SELECT name FROM {$wpdb->prefix}pod_tbl_{$pod} WHERE name LIKE '%s'", '%'.like_escape($str).'%');
			$results = $wpdb->get_col($query);
			echo join( $results, "\n" );
		}
	die;
}
</pre>
<p>Now simply deploy the input_helper on your chosen <a href="http://podscms.org/codex/pick_column">multi-pick field pod</a>. </p>
<p>But wait! It&#8217;s not saving your pod items. That&#8217;s because PodsCMS expects to receive a list of comma-separated pod ids to register the relationship. But our jQuery is outputting the name instead. </p>
<p>So we now need to add a pre-save helper to manage migrating tag names to ids.</p>
<pre class="brush:php">
<?php
$field = 'genre';
if(isset($columns[$field]['value']) &#038;&#038; $columns[$field]['value'] != ''):
$names = explode(',',$columns[$field]['value']);
$names = (empty($names)) ? $columns[$field]['value'] : $names;
if(is_array($names)) {
$vals = array();
foreach($names as $name):
	$pid = pod_check($field, $name, 'name');
	if(!$pid)
	{
		$new_tag = new PodAPI();
		$pid = $new_tag->save_pod_item(array('datatype'=>$field, 'columns' => array('name'=>$name)));
	} else {
		$pid = (is_array($pid)) ? $pid[0] : $pid;
	}
	$vals[] = $pid;
endforeach;
} else {
	$pid = pod_check($field, $name, 'name');
	if(!$pid)
	{
	  $new_tag = new PodAPI();
	  $pid = $new_tag->save_pod_item(array('datatype'=>$field, 'columns' => array('name'=>$name)));
	} else {
		$pid = (is_array($pid)) ? $pid[0] : $pid;
	}
	$vals = $pid;
}
$val_str = implode(',',$vals);
$columns[$field]['value'] = $val_str;
endif;
?>
</pre>
<p>Note that we have to tell the helper the field to which we want it to apply. We do this by setting the $field variable. If you are going to use the input helper on multiple fields, you&#8217;ll want to create a pre-save helper for each field. This helper will iterate over the submitted pod <em>names</em>, check to see if that pod exists already and getting its <em>id</em>. If the pod name does not already exist, the helper will create it.</p>
<p>Note that this helper makes use of a function called &#8220;pod_check&#8221;. You will need to add this function to your functions.php file as well. </p>
<pre class="brush:php">
function pod_check($datatype, $value='', $field='id') {
    global $wpdb;
    $datatype = pods_sanitize($datatype);
    $field = pods_sanitize($field);
    $return = $wpdb->get_col($wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}pod_tbl_{$datatype}` WHERE `$field` = ".('id'==$field?"%d":"%s"),array($value)));
    if (true == $return &#038;&#038; 0 < $return) {
    	return $return;
    } else {
    	return false;
    }
}
</pre>
<p>This function actually does the work of looking up the pod <em>id</em>.</p>
<p>And that's it. You can make any pod into a "tag" using this approach. But keep in mind that if you are using this field to relate a pods with required fields, you will need to modify the pre-save helper to add those required fields. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/add-tag-like-functionality-to-your-pod-inputs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress PodsCMS Widgets</title>
		<link>http://www.mikevanwinkle.com/wordpress/plugins/wordpress-podscms-widgets/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/plugins/wordpress-podscms-widgets/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 16:33:56 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[Pods]]></category>
		<category><![CDATA[podscms]]></category>
		<category><![CDATA[widgets]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=647</guid>
		<description><![CDATA[I&#8217;m not sure why it took me this long to put this plugin together, but whatever. I&#8217;ve been using WordPress PodCMS plugin for a long time now. And quite often I need to add pod stuff to a sidebar. Usually, I&#8217;d go find a custom sidebar that I&#8217;d made before and adapt it. But then [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not sure why it took me this long to put this plugin together, but whatever. I&#8217;ve been using WordPress PodCMS plugin for a long time now. And quite often I need to add pod stuff to a sidebar. Usually, I&#8217;d go find a custom sidebar that I&#8217;d made before and adapt it. But then I realized how super easy it would be to have a widget that allows you to select which Pod you want to show and which template you want to show it with !!! so bang!</p>
<p><strong><a title="WordPress Pods Widgets" href="http://www.mikevanwinkle.com/wp-content/uploads/2010/10/pods-widgets.zip">WordPress PodsCMS Widgets &#8211; Version 0.1</a></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/plugins/wordpress-podscms-widgets/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WordPress PodsCMS SEO Titles Plugin</title>
		<link>http://www.mikevanwinkle.com/wordpress/plugins/wordpress-podscms-seo-titles-plugin/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/plugins/wordpress-podscms-seo-titles-plugin/#comments</comments>
		<pubDate>Fri, 11 Jun 2010 20:02:54 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[cms]]></category>
		<category><![CDATA[Pods]]></category>
		<category><![CDATA[podscms]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wordpress as cms]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=494</guid>
		<description><![CDATA[I haven&#8217;t submit this plugin to the WordPress SVN yet, because I&#8217;m still playing with it. The remaining issue is that while it works, I&#8217;m not sure it works in the most efficient manner possible. I&#8217;m also going to post it over at @podscms and get some feedback. At any rate, for anyone who&#8217;s running [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t submit this plugin to the WordPress SVN yet, because I&#8217;m still playing with it. The remaining issue is that while it works, I&#8217;m not sure it works in the most efficient manner possible. I&#8217;m also going to post it over at <a title="PodsCMS" href="http://www/podscms.org">@podscms</a> and get some feedback.</p>
<p>At any rate, for anyone who&#8217;s running a pods installation and having trouble getting SEO friendly titles on your pod pages, this plugin creates a template tag &lt;?php pods_seo_title(); ?&gt; that you can use to override wordpress default behavior. The plugins check to see if the page is a pod page, and if so calls the title of the respective pod. If not, it checks to see if the page is singular and returns the TITLE | SITENAME format if it is. Otherwise it returns the SITENAME | SITE DESCRIPTION form.</p>
<p><strong>Download:</strong> <a href="http://www.mikevanwinkle.com/wp-content/uploads/2010/06/pods-seo-titles.php_.zip">Pods SEO Titles</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/plugins/wordpress-podscms-seo-titles-plugin/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Wordcamp Fayetteville Pods Presentation</title>
		<link>http://www.mikevanwinkle.com/geek-think/wordcamp-fayetteville-pods-presentation/</link>
		<comments>http://www.mikevanwinkle.com/geek-think/wordcamp-fayetteville-pods-presentation/#comments</comments>
		<pubDate>Sat, 29 May 2010 23:52:45 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[Geek Think]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Pods]]></category>
		<category><![CDATA[podscms]]></category>
		<category><![CDATA[Wordpress Pods]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=478</guid>
		<description><![CDATA[Thank you to everyone who attended my presentation on WordPress Pods at Wordcamp Fayetteville. As promised I&#8217;ve posted the presentation on slideshare.net. I also recorded the presentation with Screenflow and will hopefully get it posted tomorrow. And don&#8217;t forget to check out http://www.podscms.org.]]></description>
			<content:encoded><![CDATA[<p>Thank you to everyone who attended my presentation on WordPress Pods at Wordcamp Fayetteville. As promised I&#8217;ve posted the <a href="http://www.slideshare.net/mpvanwinkle">presentation on slideshare.net</a>. I also recorded the presentation with Screenflow and will hopefully get it posted tomorrow. And don&#8217;t forget to check out http://www.podscms.org.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/geek-think/wordcamp-fayetteville-pods-presentation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Pods Tutorials Down</title>
		<link>http://www.mikevanwinkle.com/wordpress/how-to/pods-tutorials-down/</link>
		<comments>http://www.mikevanwinkle.com/wordpress/how-to/pods-tutorials-down/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 15:37:03 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Pods]]></category>
		<category><![CDATA[Pods CMS]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress Pods]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=278</guid>
		<description><![CDATA[For some reason I&#8217;m having trouble with my pods installation. If you are looking for pods tutorials, reference this post until I get it fixed. Apologies.]]></description>
			<content:encoded><![CDATA[<p>For some reason I&#8217;m having trouble with my pods installation. If you are looking for pods tutorials, reference this post until I get it fixed. Apologies.</p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/udqnpxTdThk&#038;hl=en&#038;fs=1&#038;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/udqnpxTdThk&#038;hl=en&#038;fs=1&#038;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/AYzgy0RcEqQ&#038;rel=0&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;feature=player_profilepage&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/AYzgy0RcEqQ&#038;rel=0&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;feature=player_profilepage&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/AYzgy0RcEqQ&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/AYzgy0RcEqQ&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/wordpress/how-to/pods-tutorials-down/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress CMS has arrived</title>
		<link>http://www.mikevanwinkle.com/geek-think/wordpress-cms-has-arrived/</link>
		<comments>http://www.mikevanwinkle.com/geek-think/wordpress-cms-has-arrived/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 15:17:33 +0000</pubDate>
		<dc:creator>Mike Van Winkle</dc:creator>
				<category><![CDATA[Geek Think]]></category>
		<category><![CDATA[Pods]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Wordpress CMS]]></category>

		<guid isPermaLink="false">http://www.mikevanwinkle.com/?p=249</guid>
		<description><![CDATA[I work for a non-profit and most of my freelance clients are non-profits. Money is scarce but needs are many. Most organizations need a full content management system. They need an events calendar, a multimedia gallery, a press release section and a dozen other content types. But they can&#8217;t afford it. I used to handle [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pods.uproot.us/"><img class="alignright size-full wp-image-251" title="header-logo" src="http://www.mikevanwinkle.com/wp-content/uploads/2009/06/header-logo.png" alt="header-logo" width="300" height="100" /></a>I work for a non-profit and most of my freelance clients are non-profits. Money is scarce but needs are many. Most organizations need a full content management system. They need an events calendar, a multimedia gallery, a press release section and a dozen other content types. But they can&#8217;t afford it.</p>
<p>I used to handle this with a mishmash of plugins for calendars, downloads, videos, etc. But the problem was each solution was discrete. For instance, it was difficult to associate a video with an event. This is because, for all its advantages, the WordPress core simply is not a CMS. It basically has two content types: post and page. Yes, the functionality of custom fields helps boost the performance of these two types. But custom fields are cumbersome and user <em>un</em>-friendly.</p>
<p>What WordPress needed was some sort of <a title="Content Contrustion Kit" href="http://drupal.org/project/cck">content construction</a> plugin that would allows users to create their own types of content beyond the post and page.</p>
<p>A few months ago, I discovered a new plugin that does just that.<a title="Wordpress Pods" href="http://pods.uproot.us/"> It&#8217;s called Pods</a>. Pods is a very efficient framework that sits on top of your WordPress installation. It allows you to easily create content types and then theme those types.</p>
<p>Over the next couple weeks I&#8217;m going to post a series of tutorials on different ways you can use pods. In the meantime, head over to their site and download the plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mikevanwinkle.com/geek-think/wordpress-cms-has-arrived/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Object Caching 576/645 objects using apc

Served from: www.mikevanwinkle.com @ 2012-02-04 19:10:17 -->
