<?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>Illuminati Karate, Inc. &#187; Wordpress</title>
	<atom:link href="http://illuminatikarate.com/blog/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://illuminatikarate.com</link>
	<description>creative web design, development and marketing</description>
	<lastBuildDate>Fri, 03 Feb 2012 20:13:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>How To Add A Lightbox To A WordPress Gallery</title>
		<link>http://illuminatikarate.com/blog/wordpress-how-to-add-a-lightbox-to-a-wordpress-gallery/</link>
		<comments>http://illuminatikarate.com/blog/wordpress-how-to-add-a-lightbox-to-a-wordpress-gallery/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 14:39:25 +0000</pubDate>
		<dc:creator>Richard Gabriel</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[custom wordpress functions]]></category>
		<category><![CDATA[prettyphoto]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://illuminatikarate.com/?p=532</guid>
		<description><![CDATA[I wanted to setup a simple lightbox photo gallery on a WordPress site (v3.2.1) and, to avoid installing a slew of plugins, I put together a little gallery shortcode function using the built-in WordPress gallery shortcode as my starting point. I&#8217;m a big fan of PrettyPhoto, so I modified [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to setup a simple lightbox photo gallery on a WordPress site (v3.2.1) and, to avoid installing a slew of plugins, I put together a little gallery shortcode function using the built-in WordPress gallery shortcode as my starting point. I&#8217;m a big fan of <a title="PrettyPhoto" href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/" target="_blank">PrettyPhoto</a>, so I modified the output of the gallery shortcode to include the needed rel= attribute for PrettyPhoto galleries.<span id="more-532"></span></p>
<p>I grabbed the standard WordPress gallery shortcode from line ~758 in wp-includes/media.php and pasted it into my_theme/functions.php for modification.  For the more adventurous folks you can override the default WordPress gallery shortcode and then galleries you&#8217;ve inserted using the Media Gallery will be lightboxed.</p>
<p>Here&#8217;s the code I ended up with in functions.php <em>(shortened for readability, you&#8217;ll need to C&#038;P the entire shortcode function from wp-includes/media.php)</em>:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p532code5'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5325"><td class="code" id="p532code5"><pre class="php" style="font-family:monospace;">add_shortcode<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'my_gallery_shortcode'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_gallery_shortcode_function'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> my_gallery_shortcode_function<span style="color: #009900;">&#40;</span><span style="color: #000088;">$attr</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">,</span> <span style="color: #000088;">$wp_locale</span><span style="color: #339933;">;</span>
	<span style="color: #339933;">...</span>
	<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$attr</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'link'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">'file'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$attr</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'link'</span><span style="color: #009900;">&#93;</span> ? wp_get_attachment_link<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$size</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> wp_get_attachment_link<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$size</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">//add rel=&quot;prettyPhoto[pp_gal]&quot;</span>
		<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&gt;&lt;img'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'rel=&quot;prettyPhoto[pp_gal]&quot; &gt;&lt;img'</span><span style="color: #339933;">,</span><span style="color: #000088;">$link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;<span style="color: #006699; font-weight: bold;">{$itemtag}</span> class='gallery-item'&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;
			&lt;<span style="color: #006699; font-weight: bold;">{$icontag}</span> class='gallery-icon'&gt;
				<span style="color: #006699; font-weight: bold;">$link</span>
			&lt;/<span style="color: #006699; font-weight: bold;">{$icontag}</span>&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$captiontag</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/trim"><span style="color: #990000;">trim</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$attachment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;
				&lt;<span style="color: #006699; font-weight: bold;">{$captiontag}</span> class='wp-caption-text gallery-caption'&gt;
				&quot;</span> <span style="color: #339933;">.</span> wptexturize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$attachment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_excerpt</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;
				&lt;/<span style="color: #006699; font-weight: bold;">{$captiontag}</span>&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/<span style="color: #006699; font-weight: bold;">{$itemtag}</span>&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$columns</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">++</span><span style="color: #000088;">$i</span> <span style="color: #339933;">%</span> <span style="color: #000088;">$columns</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;br style=&quot;clear: both&quot; /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;
			&lt;br style='clear: both;' /&gt;
		&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>My edit was small, I added <code>$link=str_replace('&gt;&lt;img','rel="prettyPhoto[pp_gal]" &gt;&lt;img',$link);</code> to the gallery output so that PrettyPhoto can do it&#8217;s thing.</p>
<p>Now that you have that all you need to do is be sure you&#8217;re including the necessary files:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p532code6'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5326"><td class="code" id="p532code6"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> media<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;all&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?=bloginfo('template_directory');?&gt;/prettyPhoto/css/prettyPhoto.css&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?=bloginfo('template_directory');?&gt;/prettyPhoto/js/jquery.prettyPhoto.js&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>And be sure to call PrettyPhoto:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p532code7'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5327"><td class="code" id="p532code7"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> charset<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;utf-8&quot;</span><span style="color: #339933;">&gt;</span>
	$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a[rel^='prettyPhoto']&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">prettyPhoto</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Now all you need to do is upload photos to your gallery and use this shortcode on your page:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p532code8'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5328"><td class="code" id="p532code8"><pre class="html" style="font-family:monospace;">[my_gallery_shortcode link=&quot;file&quot;]</pre></td></tr></table></div>

<p>And that&#8217;s it!  A quick solution to adding a lightbox to your WordPress gallery.</p>
]]></content:encoded>
			<wfw:commentRss>http://illuminatikarate.com/blog/wordpress-how-to-add-a-lightbox-to-a-wordpress-gallery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: How To Change Comment Excerpt Length</title>
		<link>http://illuminatikarate.com/blog/wordpress-how-to-change-comment-excerpt-length/</link>
		<comments>http://illuminatikarate.com/blog/wordpress-how-to-change-comment-excerpt-length/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 18:17:17 +0000</pubDate>
		<dc:creator>Richard Gabriel</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[custom wordpress functions]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://illuminatikarate.com/?p=493</guid>
		<description><![CDATA[I recently needed to output a list of comments and bumped into a little trouble trying to output the comment excerpt. Usually I would use the built-in comment_excerpt() function but I only needed 10 words instead of the 20 that is hard-coded. I put together a little function that [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to output a list of comments and bumped into a little trouble trying to output the comment excerpt.  Usually I would use the built-in comment_excerpt() function but I only needed 10 words instead of the 20 that is hard-coded.  I put together a little function that I found helpful and thought I would share.</p>
<p>  <span id="more-493"></span></p>
<p>I started with get_comment_excerpt() from line ~407 of wp-includes/comment-template.php and pasted it into my_name/functions.php to be modified.</p>
<p>Here&#8217;s what I ended up with:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p493code11'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p49311"><td class="code" id="p493code11"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_get_comment_excerpt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment_ID</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$num_words</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$comment</span> <span style="color: #339933;">=</span> get_comment<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$comment_ID</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$comment_text</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strip_tags"><span style="color: #990000;">strip_tags</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$blah</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$comment_text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$blah</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$num_words</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$k</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$num_words</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$use_dotdotdot</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$k</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$blah</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$use_dotdotdot</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$excerpt</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$k</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$excerpt</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$blah</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000088;">$excerpt</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$use_dotdotdot</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'...'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_comment_excerpt'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$excerpt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><br/></p>
<p>And here&#8217;s a little code to output a list of comments using this function:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p493code12'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p49312"><td class="code" id="p493code12"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>ul<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> 
	<span style="color: #000088;">$comments</span> <span style="color: #339933;">=</span> get_comments<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$c</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;?php echo get_permalink(<span style="color: #006699; font-weight: bold;">$c-&gt;comment_post_ID</span>); ?&gt;&quot;</span><span style="color: #339933;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* output 10 words of comment */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> my_get_comment_excerpt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_ID</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>		
		<span style="color: #339933;">&lt;</span>span<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_author</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>span<span style="color: #339933;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?</span>php <span style="color: #b1b100;">echo</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;m/j/Y&quot;</span><span style="color: #339933;">,</span><a href="http://www.php.net/strtotime"><span style="color: #990000;">strtotime</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$c</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_date</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>li<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Feel free to ask questions in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://illuminatikarate.com/blog/wordpress-how-to-change-comment-excerpt-length/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WP e-Commerce Category Product List Shortcode</title>
		<link>http://illuminatikarate.com/blog/wp-e-commerce-category-product-list-shortcode/</link>
		<comments>http://illuminatikarate.com/blog/wp-e-commerce-category-product-list-shortcode/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 17:35:59 +0000</pubDate>
		<dc:creator>Richard Gabriel</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[custom wordpress functions]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[WP E-Commerce]]></category>

		<guid isPermaLink="false">http://illuminatikarate.com/?p=570</guid>
		<description><![CDATA[While setting up a store using WP e-Commerce (v3.8.5 at the time of development) I noticed that the Category Product List Shortcode was no longer working for me. I cooked up a quick shortcode function using some of their product list code that will query the products by the [...]]]></description>
			<content:encoded><![CDATA[<p>While setting up a store using <a href="http://www.instinct.co.nz/e-commerce/" target="_blank" title="WP E-Commerce">WP e-Commerce</a> <em>(v3.8.5 at the time of development)</em> I noticed that the <a href="http://www.instinct.co.nz/e-commerce/integration/" target="_blank">Category Product List Shortcode</a> was no longer working for me.  </p>
<p>I cooked up a quick shortcode function using some of their product list code that will query the products by the passed category and output them using the product template.<span id="more-570"></span></p>
<p>First, place the following code in my_theme/functions.php:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p570code14'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p57014"><td class="code" id="p570code14"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_wpsc_products_shortcode<span style="color: #009900;">&#40;</span><span style="color: #000088;">$atts</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$number_per_page</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'use_pagination'</span><span style="color: #009900;">&#41;</span> ? get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wpsc_products_per_page'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> shortcode_atts<span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'category_id'</span> <span style="color: #339933;">=&gt;</span> <a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$atts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cat'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$atts</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cat'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'limit_of_items'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'sort_order'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'number_per_page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$number_per_page</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'page'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$atts</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> wpsc_display_products_page<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_shortcode<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'my_wpsc_category'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_wpsc_products_shortcode'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Once that&#8217;s done you&#8217;ll be able to use <code>[my_wpsc_category cat=6 /]</code>, where 6 is the integer ID of the category, on whichever page you want the products displayed on.  </p>
<p>This list will be output using the wpsc-single_product.php template or the wpsc-products_page.php template, depending on whether you have multiple products in the category.</p>
<p>Feel free to ask questions in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://illuminatikarate.com/blog/wp-e-commerce-category-product-list-shortcode/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Exclude WordPress&#8217; Admin URLs from your AWStats Reports</title>
		<link>http://illuminatikarate.com/blog/exclude-wordpress-admin-urls-from-your-awstats-reports/</link>
		<comments>http://illuminatikarate.com/blog/exclude-wordpress-admin-urls-from-your-awstats-reports/#comments</comments>
		<pubDate>Tue, 10 Mar 2009 17:58:52 +0000</pubDate>
		<dc:creator>George Huger</dc:creator>
				<category><![CDATA[Analytics]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[awstats]]></category>

		<guid isPermaLink="false">http://illuminatikarate.com/blog/?p=18</guid>
		<description><![CDATA[After upgrading a friend&#8217;s blog to WordPress 2.7 we started noticing his pageview numbers in AWStats going through the roof, without a corresponding increase in visitors. Here&#8217;s a screenshot: Google Analytics was showing normal pageview numbers, so we knew something was amiss. When we looked at the most viewed [...]]]></description>
			<content:encoded><![CDATA[<p>After upgrading a friend&#8217;s blog to WordPress 2.7 we started noticing his pageview numbers in AWStats going through the roof, without a corresponding increase in visitors. Here&#8217;s a screenshot:</p>
<p><a href="http://illuminatikarate.com/wp-content/uploads/2009/03/aws-pageviews-feb-sic.png"><img class="aligncenter size-full wp-image-26" title="Screenshot of AWStats seemingly overreporting pageviews" src="http://illuminatikarate.com/wp-content/uploads/2009/03/aws-pageviews-feb-sic.png" alt="Screenshot of AWStats seemingly overreporting pageviews" width="430" height="69" /></a></p>
<p>Google Analytics was showing normal pageview numbers, so we knew something was amiss. When we looked at the most viewed pages in awstats, it became obvious:</p>
<p><a href="http://illuminatikarate.com/wp-content/uploads/2009/03/aws-pageviews-per-page-feb-sic1.png"><img src="http://illuminatikarate.com/wp-content/uploads/2009/03/aws-pageviews-per-page-feb-sic1.png" alt="Screenshot of AWStats views per page, showing 2228 hits on WP&#039;s admin-ajax.php file" title="Screenshot of AWStats views per page, showing 2228 hits on WP&#039;s admin-ajax.php file" width="500" height="38" class="aligncenter wp-image-28" /></a></p>
<p>AWStats has always counted pageviews on the WordPress backend, but compared to the total pageviews the impact was negligible. However, now that WordPress 2.7 makes so many AJAX calls to admin-ajax.php (primarily for saving drafts), we must exclude these pageviews from our reports to leave meaningful data. Thankfully its very easy.</p>
<p><span id="more-370"></span>We&#8217;re going to instruct awstats to ignore hits on any page in the wp-admin directory. Alternatively, we could have AWStats ignore our IP address, which has its own merits, but this approach becomes cumbersome when multiple authors and dynamic IPs come into play. </p>
<p>Instructions:</p>
<ol>
<li>Open the awstats .conf file which corresponds to your domain. On most shared hosting accounts this will be located in /tmp/awstats/. If you see more than one .conf file, choose the one which matches the domain of the site you are working on.</li>
<li>Look for the line which starts with:
<pre class="code">SkipFiles="</pre>
<p>AWStats is usually already configured to exclude robots.txt and favicon.ico, so the line probably looks like this:
<pre class="code">SkipFiles="robots.txt$ favicon.ico$"</pre>
</li>
<li>Append the following string after the last filename listed (make sure to leave a space), but before the quote:
<pre class="code"> REGEX[^/wp-admin/]</pre>
<p>If you&#8217;re file looks like mine, the line should now read:
<pre class="code">SkipFiles="robots.txt$ favicon.ico$ REGEX[^/wp-admin/]"</pre>
</li>
<li>Save and upload the file. If you&#8217;re on shared hosting, you&#8217;ll want to CHMOD the .conf file to 444, otherwise your changes are likely to be overwritten.</li>
</ol>
<p>That&#8217;s it! This change is not retroactive, but if all went well you should be able to write a new post in WordPress and the pageviews for admin-ajax.php will not increase.</p>
]]></content:encoded>
			<wfw:commentRss>http://illuminatikarate.com/blog/exclude-wordpress-admin-urls-from-your-awstats-reports/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

