<?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>kucrut</title>
	<atom:link href="http://kucrut.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://kucrut.org</link>
	<description>Life, WordPress, GNU/Linux, Freedom!</description>
	<lastBuildDate>Wed, 13 Feb 2013 21:51:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Minimize KDE IM Contacts to System Tray</title>
		<link>http://kucrut.org/minimize-kde-im-contacts-to-system-tray/</link>
		<comments>http://kucrut.org/minimize-kde-im-contacts-to-system-tray/#comments</comments>
		<pubDate>Wed, 13 Feb 2013 21:50:51 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=204</guid>
		<description><![CDATA[It bothers me that KDE IM Contacts logs you out when you close the main window, and there&#8217;s no GUI to change this behavior. The &#8220;fix&#8221; is simple, just edit ~/.kde/share/config/ktp-contactlistrc and change go_offline_when_closing value to false: [General] go_offline_when_closing=false Source: KDE Forums]]></description>
				<content:encoded><![CDATA[<p>It bothers me that KDE IM Contacts logs you out when you close the main window, and there&#8217;s no GUI to change this behavior. The &#8220;fix&#8221; is simple, just edit <code>~/.kde/share/config/ktp-contactlistrc</code> and change <code>go_offline_when_closing</code> value to <code>false</code>:</p>
<pre>
[General]
go_offline_when_closing=false
</pre>
<p><strong>Source</strong>: <a href="http://forum.kde.org/viewtopic.php?f=18&#038;t=102096">KDE Forums</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/minimize-kde-im-contacts-to-system-tray/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KC Settings Data</title>
		<link>http://kucrut.org/kc-settings-data/</link>
		<comments>http://kucrut.org/kc-settings-data/#comments</comments>
		<pubDate>Sat, 09 Jun 2012 19:30:57 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=189</guid>
		<description><![CDATA[Just a quick note to those of you using KC Settings. As of version 2.6.8, all variables in kcSettings class have been merged and set to private. So if you&#8217;ve previously used kcSettings::$data, you will need to change your code to use the available method: kcSettings::get_data(). This static method behaves exactly like kc_get_option(), so you [...]]]></description>
				<content:encoded><![CDATA[<p>Just a quick note to those of you using KC Settings. As of version 2.6.8, all variables in kcSettings class have been merged and set to private. So if you&#8217;ve previously used <code>kcSettings::$data</code>, you will need to change your code to use the available method: <code>kcSettings::get_data()</code>. This static method behaves exactly like <code>kc_get_option()</code>, so you can put as many arguments (the array keys) as you like there to get the data you need, for example:</p>
<pre>kcSettings::get_data('settings', 'plugin', 'myprefix', 'mysection')</pre>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/kc-settings-data/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Add HTML Tags in Post and Widget Titles</title>
		<link>http://kucrut.org/add-html-tags-in-post-widget-titles/</link>
		<comments>http://kucrut.org/add-html-tags-in-post-widget-titles/#comments</comments>
		<pubDate>Thu, 03 May 2012 11:49:46 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[Hook]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=185</guid>
		<description><![CDATA[In a recent project, I needed to use &#60;span /&#62; tags to add some styles (just color, actually) to post and widget titles. By default &#8212; and there&#8217;s no hook to disable this &#8212; WordPress strips any HTML tags found in post and widget titles. Here&#8217;s my solution to this problem. Please keep in mind [...]]]></description>
				<content:encoded><![CDATA[<p>In a recent project, I needed to use <code>&lt;span /&gt;</code> tags to add some styles (just color, actually) to post and widget titles. By default &mdash; and there&#8217;s no hook to disable this &mdash; WordPress strips any HTML tags found in post and widget titles. Here&#8217;s my solution to this problem. Please keep in mind that I only needed to add <code>&lt;span /&gt;</code> tags, so if you need to add more tags, you should modify the code to fit your needs :)<span id="more-185"></span></p>
<p>First, add the span tags to the desired post and widget titles, replacing the <code>&lt;</code> and <code>&gt;</code> characters with hashes ( <code>#</code> ):<br />
<div id="attachment_186" class="wp-caption aligncenter" style="width: 410px"><img src="http://kucrut.org/content/uploads/2012/05/post-widget-titles.png" alt="" title="Add fake span tags to post and widget titles" width="400" height="350" class="size-full wp-image-186" /><p class="wp-caption-text">Add fake span tags to post and widget titles</p></div></p>
<p>Now, let&#8217;s create a tiny mu-plugin to handle our HTML tags. We&#8217;ll be using four filter hooks for this:</p>
<ul>
<li><code>the_title</code>, triggered in post titles</li>
<li><code>the_title_rss</code>, triggered in post titles for feeds</li>
<li><code>wp_title</code>, triggered in HTML document title, and</li>
<li><code>widget_title</code>, triggered in &mdash; well, you guessed it right &mdash; widget titles</li>
</ul>
<p>The plugin:</p>
<pre>
&lt;?php
/*
Plugin Name: Enable HTML tags in post and widget titles
Author: Dzikri Aziz
Author URI: http://kucrut.org/
Version: 0.1
License: GPL v2
*/


function kc_convert_title_html_tags( $string ) {
  global $wp_current_filter;
  $filter = end($wp_current_filter);
  $search = array('#span#', '#/span#');
  <span class="impo">$replace</span> = ( in_array($filter, array('wp_title', 'the_title_rss')) || ($filter == 'the_title' &#038;&#038; (is_admin() || in_array('wp_head', $wp_current_filter))) ) ? '' : array('&lt;span&gt;', '&lt;/span&gt;');
  $string = str_replace( $search, $replace, $string );

  return $string;
}

add_filter( 'the_title', 'kc_convert_title_html_tags' );
add_filter( 'the_title_rss', 'kc_convert_title_html_tags' );
add_filter( 'wp_title', 'kc_convert_title_html_tags' );
add_filter( 'widget_title', 'kc_convert_title_html_tags' );

?&gt;
</pre>
<p>Take a closer look to the replacement string. We need to strip our <em>fake</em> HTML tags from the post titles when:</p>
<ul>
<li><code>kc_convert_title_html_tags()</code> is called by <code>wp_title</code> or <code>the_title_rss</code> hook</li>
<li><code>the_title</code> filter hook is triggered from within <code>wp_head</code> action hook (eg. the post title is used by the title attribute of feed links</li>
<li>we&#8217;re viewing a post table in admin area.</li>
</ul>
<p>However, when we&#8217;re inside the <code>&lt;body /&gt;</code>, they need to be converted to the real tags.</p>
<p>That&#8217;s it! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/add-html-tags-in-post-widget-titles/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>3 Jagoan Internet</title>
		<link>http://kucrut.org/3-jagoan-internet/</link>
		<comments>http://kucrut.org/3-jagoan-internet/#comments</comments>
		<pubDate>Tue, 06 Mar 2012 11:05:37 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=182</guid>
		<description><![CDATA[Ternyata slogannya emang asli banget, ga ngecewain. Kuenceng, murah, stabil! Dengan modem pas-pasan dan sinyal paling tinggi 40%, gw bisa dapet segini nih:]]></description>
				<content:encoded><![CDATA[<p>Ternyata <a href="http://internet.tri.co.id/">slogannya</a> emang asli banget, ga ngecewain. Kuenceng, murah, stabil! Dengan modem pas-pasan dan sinyal paling tinggi 40%, gw bisa dapet segini nih:</p>
<p><a href="http://kucrut.org/content/uploads/2012/03/3-jagoan-internet.png"><img src="http://kucrut.org/content/uploads/2012/03/3-jagoan-internet-600x337.png" alt="3-jagoan-internet" width="600" height="337" class="aligncenter size-large wp-image-183" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/3-jagoan-internet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>wp_list_pages() for Custom Post Types</title>
		<link>http://kucrut.org/wp_list_pages-for-custom-post-types/</link>
		<comments>http://kucrut.org/wp_list_pages-for-custom-post-types/#comments</comments>
		<pubDate>Sat, 18 Feb 2012 20:34:26 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=181</guid>
		<description><![CDATA[wp_list_pages() is a handy little function for displaying a list of hierarchical post type, and it works with custom post types too. Unfortunately, when used for a custom post type, the list items don&#8217;t have the necessary CSS classes for current page item/ancestors. Here&#8217;s a quick fix for this particular problem. function kct_page_css_class( $css_class, $page, [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://codex.wordpress.org/Function_Reference/wp_list_pages">wp_list_pages()</a> is a handy little function for displaying a list of hierarchical post type, and it <a href="http://codex.wordpress.org/Function_Reference/wp_list_pages#List_members_of_a_custom_post_type">works</a> with custom post types too. Unfortunately, when used for a custom post type, the list items don&#8217;t have the necessary CSS classes for current page item/ancestors. Here&#8217;s a quick fix for this particular problem.</p>
<pre>
function kct_page_css_class( $css_class, $page, $depth, $args ) {
  if ( empty($args['post_type']) || !is_singular($args['post_type']) )
    return $css_class;

  $_current_page = get_queried_object();

  if ( in_array( $page->ID, $_current_page->ancestors ) )
    $css_class[] = 'current_page_ancestor';
  if ( $page->ID == $_current_page->ID )
    $css_class[] = 'current_page_item';
  elseif ( $_current_page &#038;&#038; $page->ID == $_current_page->post_parent )
    $css_class[] = 'current_page_parent';

  return $css_class;
}
add_filter( 'page_css_class', 'kct_page_css_class', 10, 4 );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/wp_list_pages-for-custom-post-types/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Override max-width</title>
		<link>http://kucrut.org/override-max-width/</link>
		<comments>http://kucrut.org/override-max-width/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 11:20:30 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=180</guid>
		<description><![CDATA[Just use none :) .hentry img {height:auto; max-width:100%} .hentry .someclass img {max-width:none}]]></description>
				<content:encoded><![CDATA[<p>Just use <code>none</code> :)</p>
<pre>
.hentry img {height:auto; max-width:<span class="impo">100%</span>}
.hentry .someclass img {max-width:<span class="impo">none</span>}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/override-max-width/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KC DropBox</title>
		<link>http://kucrut.org/kc-dropbox/</link>
		<comments>http://kucrut.org/kc-dropbox/#comments</comments>
		<pubDate>Mon, 06 Feb 2012 13:57:47 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=175</guid>
		<description><![CDATA[Here&#8217;s a simple plugin for uploading files from your WordPress site front-end. It uses Jaka Jancar&#8217;s DropBox Uploader and inspired by a tutorial on WP Tuts+ (although I took a slightly different approach). It&#8217;s pretty easy to use and you can integrate it in your contact forms. Clone/download it from GitHub and feel free to [...]]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s a simple plugin for uploading files from your WordPress site front-end. It uses <a href="http://jaka.kubje.org/projects/dropbox-uploader/">Jaka Jancar&#8217;s DropBox Uploader</a> and inspired by a <a href="http://wp.tutsplus.com/tutorials/simple-plugin-which-lets-users-upload-files-into-your-dropbox-folder/">tutorial</a> on WP Tuts+ (although I took a slightly different approach). It&#8217;s pretty easy to use and you can integrate it in your contact forms.</p>
<p>Clone/download it from <a href="https://github.com/kucrut/kc-dropbox">GitHub</a> and feel free to <a href="http://kucrut.org/kc-dropbox/#comments">let me know</a> if you have any problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/kc-dropbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PulseAudio Equalizer</title>
		<link>http://kucrut.org/pulseaudio-equalizer/</link>
		<comments>http://kucrut.org/pulseaudio-equalizer/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 08:26:47 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[F|OSS]]></category>
		<category><![CDATA[Gentoo]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=170</guid>
		<description><![CDATA[Finally got PulseAudio&#8217;s equalizer working. It consumes 1-4% of my 2.30GHz i5 CPU (Clementine&#8217;s built-in equalizer consumes 4-7%, btw), and sounds really good :) In Gentoo, all you need to do to get this working is to install pulseaudio with equalizer USE-flag enabled (may need to unmask the unstable ebuild) and append this line to [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://kucrut.org/content/uploads/2012/01/pulseaudio-eq.jpeg"><img src="http://kucrut.org/content/uploads/2012/01/pulseaudio-eq-600x337.jpeg" alt="pulseaudio-eq" width="600" height="337" class="aligncenter size-large wp-image-171" /></a></p>
<p>Finally got PulseAudio&#8217;s <a href="http://pulseaudio.org/wiki/SystemEqualizer">equalizer</a> working. It consumes 1-4% of my 2.30GHz i5 CPU (<a href="http://www.clementine-player.org/">Clementine&#8217;s</a> built-in equalizer consumes 4-7%, btw), and sounds really good :) <span id="more-170"></span></p>
<p>In Gentoo, all you need to do to get this working is to install pulseaudio with <code>equalizer</code> USE-flag enabled (may need to unmask the unstable ebuild) and append this line to <code>/etc/pulse/default.pa</code> or <code>~/.pulse/default.pa</code> (you can change the sink name to your liking) :</p>
<pre>
load-module module-equalizer-sink sink_name=<span class="impo">equalized</impo>
</pre>
<p>After that, quit all applications that use pulseadio and restart pulseaudio:</p>
<pre>
pulseaudio --kill &#038;&#038; pulseaudio --start
</pre>
<p>Now you should be able to use the equalized sink name for your multimedia application. For example, in Clementine, go to <em>Tools</em> &raquo; <em>Preferences</em> &raquo; <em>Playback</em> and change the <em>Output plugin</em> to PulseAudio Sink and fill the <em>Output device</em> field with your equalized sink name (<code>equalized</code> in the above example).</p>
<p>While Clementine&#8217;s playing, adjust the equalizer levels by running <code>qpaeq</code>. All done! ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/pulseaudio-equalizer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KDE 4.8 Taskbar</title>
		<link>http://kucrut.org/kde-4-8-taskbar/</link>
		<comments>http://kucrut.org/kde-4-8-taskbar/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 12:46:43 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[F|OSS]]></category>
		<category><![CDATA[KDE]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=166</guid>
		<description><![CDATA[I&#8217;m not really sure if this feature is part of KDE SC 4.8, but it&#8217;s so cool and I feel like I have to write about it here :) See the screenshot above? KDE&#8217;s default taskbar is now more powerful than ever! Right clicking on a taskbar item now gives you the ability to start [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m not really sure if this feature is part of KDE SC 4.8, but it&#8217;s so cool and I feel like I have to write about it here :)</p>
<p><img src="http://kucrut.org/content/uploads/2012/01/kde-taskbar-4.8-600x176.jpg" alt="" title="kde-taskbar-4.8" width="600" height="176" class="aligncenter size-large wp-image-167" /></p>
<p>See the screenshot above? KDE&#8217;s default taskbar is now more powerful than ever! Right clicking on a taskbar item now gives you the ability to start a new instance of that application, <em>and</em> add a launcher of that application to the taskbar when it&#8217;s not running.</p>
<p>I know, it&#8217;s pretty similar to what Windows 7 offers, except (IMO) it&#8217;s waay cooler. In Windows 7, if you pinned an application to the taskbar, it will only show an icon, without the application name/window title, no matter the state of the application is (running or not). In KDE, well, you guessed it, if the application is not currently running, an icon will be added to the taskbar, and it will disappear when it&#8217;s launched.</p>
<p>If you really want Windows 7&#8242;s taskbar in KDE, you can install this <a href="http://kde-look.org/content/show.php/Icon+Tasks?content=144808">plugin</a> :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/kde-4-8-taskbar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Built-in Post Finder in Plugins</title>
		<link>http://kucrut.org/using-built-in-post-finder-in-plugins/</link>
		<comments>http://kucrut.org/using-built-in-post-finder-in-plugins/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 00:54:23 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=162</guid>
		<description><![CDATA[I was making some improvements to the KC Posts widget module in my KC Essentials plugin, and I wanted to make it easy for the users to find post IDs they want to include/exclude from the query. As you may already know, in the Media admin page, we can &#8216;attach&#8217; an attachment to a post. [...]]]></description>
				<content:encoded><![CDATA[<p>I was making some improvements to the KC Posts widget module in my <a href="https://github.com/kucrut/kc-essentials/">KC Essentials</a> plugin, and I wanted to make it easy for the users to find post IDs they want to include/exclude from the query. As you may already know, in the <em>Media</em> admin page, we can &#8216;attach&#8217; an attachment to a post. It uses a neat jQuery UI dialog box to find posts. Here&#8217;s how I use it in KC Essentials.<br />
<span id="more-162"></span><br />
First add we need to add the dialog box and the required JS to the admin page, in my case, it&#8217;s <code>widgets.php</code>.</p>
<pre>
add_action( 'load-<span class="impo">widgets.php</span>', 'my_widgets_admin_actions' );
function my_widgets_admin_actions() {
  # Enqueue scripts
  wp_enqueue_script( 'my-widgets-admin-scripts', plugins_url('myscript.js', __FILE__), array('media', 'wp-ajax-response'), '0.1', true );

  # Add the finder dialog box
  add_action( 'admin_footer', 'find_posts_div', 99 );
}
</pre>
<p>Next, create <code>myscript.js</code> file inside the plugin directory and add these lines:</p>
<pre>
jQuery(document).ready(function($) {
  // Find posts
  var $findBox = $('#find-posts'),
      $found   = $('#find-posts-response'),
      $findBoxSubmit = $('#find-posts-submit');

  // Open
  $(<span class="impo">'input.kc-find-post'</span>).live('dblclick', function() {
    $findBox.data('kcTarget', $(this));
    findPosts.open();
  });

  // Insert
  $findBoxSubmit.click(function(e) {
    e.preventDefault();

    // Be nice!
    if ( !$findBox.data('kcTarget') )
      return;

    var $selected = $found.find('input:checked');
    if ( !$selected.length )
      return false;

    var $target = $findBox.data('kcTarget'),
        current = $target.val(),
        current = current === '' ? [] : current.split(','),
        newID   = $selected.val();

    if ( $.inArray(newID, current) < 0 ) {
      current.push(newID);
      $target.val( current.join(',') );
    }
  });

  // Double click on the radios
  $('input[name="found_post_id"]', $findBox).live('dblclick', function() {
    $findBoxSubmit.trigger('click');
  });

  // Close
  $( '#find-posts-close' ).click(function() {
    $findBox.removeData('kcTarget');
  });
});
</pre>
<p>A quick explanation:<br />
When the user double-clicks the <code>input.kc-find-post</code> field, the finder dialog box will popup. Clicking the <em>Select</em> button will send the selected post's ID to the input field. This can also be done by double-clicking one of the radio inputs at the left side of each found posts.</p>
<p>Need a demo? Just install <a href="https://github.com/kucrut/kc-essentials/">KC Essentials</a> :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/using-built-in-post-finder-in-plugins/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Move Cursor to the Next/Previous Paragraph in Kate</title>
		<link>http://kucrut.org/move-cursor-to-next-prev-paragraph-in-kate/</link>
		<comments>http://kucrut.org/move-cursor-to-next-prev-paragraph-in-kate/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 00:05:53 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[F|OSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Kate]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=160</guid>
		<description><![CDATA[It kind of irritates me that Kate doesn&#8217;t have a builtin functionality to move cursor to the next/previous paragraph. Fortunately, as with most KDE SC applications, Kate is extendable with custom scripts. So here&#8217;s my solution for the mentioned problem. /* kate-script * author: Dzikri Aziz * license: GPLv2 * revision: 3 * kate-version: 3.4 [...]]]></description>
				<content:encoded><![CDATA[<p>It kind of irritates me that <a href="http://kate-editor.org/" title="KDE Advanced Text Editor">Kate</a> doesn&#8217;t have a builtin functionality to move cursor to the next/previous paragraph. Fortunately, as with most <a href="http://kde.org/">KDE SC</a> applications, Kate is extendable with <a href="http://kate-editor.org/2010/07/09/kate-scripted-actions/">custom scripts</a>. So here&#8217;s my solution for the mentioned problem.<span id="more-160"></span></p>
<pre>
/* kate-script
 * author: Dzikri Aziz <kucrut@kucrut.org>
 * license: GPLv2
 * revision: 3
 * kate-version: 3.4
 * type: commands
 * functions: jumpUp, jumpDown
 *
 * Move cursor to next/previous paragraph
 */

function jumpDown() {
  return _jump();
}


function jumpUp() {
  return _jump( true );
}


function action( cmd ) {
  var a = new Object();
  if ( cmd == 'jumpUp' ) {
    a.text = i18n('Move cursor to previous paragraph');
    a.shortcut = 'Alt+Up';
    a.icon = "";
    a.category = "";
    a.interactive = false;
  }
  else if ( cmd == 'jumpDown' ) {
    a.text = i18n('Move cursor to next paragraph');
    a.shortcut = 'Alt+Down';
    a.icon = "";
    a.category = "";
    a.interactive = false;
  }

  return a;
}


function help( cmd ) {
  if (cmd == 'jumpUp') {
    return i18n('Move cursor to previous paragraph');
  }
  else if (cmd == 'jumpDown') {
    return i18n('Move cursor to next paragraph');
  }
}


function _jump( up ) {
  var init   = curPos = view.cursorPosition().line,
      lines  = document.lines(),
      target;

  if ( document.firstColumn(curPos) == -1 )
    curPos = document.prevNonEmptyLine(curPos);

  if ( up === true ) {
    target = 0;
    while ( curPos-- > 0 ) {
      if ( document.firstColumn(curPos) == -1 &#038;&#038; document.nextNonEmptyLine(curPos) != init ) {
        target = document.nextNonEmptyLine(curPos);
        break;
      }
    }
  }

  else {
    lines--;
    target = lines;
    while ( curPos++ < lines ) {
      if ( document.firstColumn(curPos) == -1 &#038;&#038; document.nextNonEmptyLine(curPos) != init ) {
        target = document.nextNonEmptyLine(curPos);
        break;
      }
    }
  }

  view.setCursorPosition(target, 0);
}
</pre>
<p>Save this script as <code>jump.js</code> inside katepart directory in your KDE user directory, eg: <code>$KDEHOME/share/apps/katepart/script</code> (just create the sub-directories if they don't exist yet) and relaunch Kate. Now you can move the cursor to the next paragraph by pressing <code>Alt+Up</code> or the previous one by pressing <code>Alt+Down</code>. You can freely customize the shortcut from <em>Settings &raquo; Configure Shortcuts</em>.</p>
<p>Any improvements are welcome!</p>
<p>As a bonus, here's the <a href="http://www.box.com/s/yn53ytty7gm8d9afodp5">scripting guide</a> I printed from Google cache.</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/move-cursor-to-next-prev-paragraph-in-kate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>jQuery in Widgets Admin Page</title>
		<link>http://kucrut.org/jquery-in-widgets-admin-page/</link>
		<comments>http://kucrut.org/jquery-in-widgets-admin-page/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 20:31:15 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=159</guid>
		<description><![CDATA[Here&#8217;s a quick tip. If you built a custom widget for your themes/plugins and you need jQuery for the configuration form, you&#8217;ll need to call it when the ajax process is done, that is when a widget was just dropped to a sidebar/widget area, or the user just saved the configuration. jQuery(document).ready(function($) { $('.widgets-sortables').ajaxSuccess(function() { [...]]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s a quick tip. If you built a custom widget for your themes/plugins and you need jQuery for the configuration form, you&#8217;ll need to call it when the ajax process is done, that is when a widget was just dropped to a sidebar/widget area, or the user just saved the configuration.</p>
<pre>
jQuery(document).ready(function($) {
  $('.widgets-sortables').ajaxSuccess(function() {
    <span class="ccomment">// do your thing</span>
  });
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/jquery-in-widgets-admin-page/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Hacking Term List Table</title>
		<link>http://kucrut.org/hacking-term-list-table/</link>
		<comments>http://kucrut.org/hacking-term-list-table/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 13:33:57 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Hook]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=154</guid>
		<description><![CDATA[Term list table, unlike post list table, is not very customizable. What I needed was to display the thumbnail/icon of each term, to make it easier for the content editors to distinguish one term from another. I consider this as a hack, not because we&#8217;re going to edit a core file (never ever do that, [...]]]></description>
				<content:encoded><![CDATA[<p>Term list table, unlike <a href="http://scribu.net/wordpress/custom-sortable-columns.html">post</a> <a href="http://scribu.net/wordpress/sortable-taxonomy-columns.html">list</a> <a href="http://theme.fm/2011/07/hacking-the-wordpress-admin-mastering-custom-columns-758/">table</a>, is not very customizable. What I needed was to display the thumbnail/icon of each term, to make it easier for the content editors to distinguish one term from another.</p>
<p><img src="http://kucrut.org/content/uploads/2012/01/term-table.jpg" alt="" title="Term Table" width="740" height="408" class="aligncenter size-full wp-image-155" /></p>
<p><span id="more-154"></span></p>
<p>I consider this as a hack, not because we&#8217;re going to edit a core file (never ever do that, please!), but because we&#8217;re (ab)using a <em>filter</em> hook to display the thumbnail, which should normally be done through an <em>action</em> hook. Unfortunately, if we take a look at <code>wp-admin/includes/class-wp-terms-list-table.php</code> file, there&#8217;s only one action hook in there, which can&#8217;t help us. However, there&#8217;s a filter hook that can be useful for our situation: <code>"{$taxonomy}_row_actions"</code>, normally used to customize the action links that show up when we hover over a term row.</p>
<p>Before we begin, We need to decide how we attach an image to a term. There are many plugins out there that can help us with this, but in this guide we&#8217;ll be using my own plugin, <a href="http://wordpress.org/extend/plugins/kc-settings/">KC Settings</a>. By the way, if the plugin of your choice doesn&#8217;t use <code>termmeta</code> table to store terms metadata, I strongly suggest you to look for another plugin :)</p>
<p>Let&#8217;s get started with creating a mu-plugin file, or editing a our theme&#8217;s <code>function.php</code> file (not recommended). We&#8217;ll be using the <em>category</em> taxonomy throughout this guide, but you can off course use other taxonomies.</p>
<p>First we&#8217;ll add an entry for KC Settings, (please refer to the sample files included in the plugin to learn about the setting array), or you can also use the Builder if you like.</p>
<pre>
function my_category_metadata( $groups ) {
  $groups[] = array(
    '<span class="impo">category</span>' =&gt; array(
      array(
        'id'        =&gt; 'category-meta',
        'title'     =&gt; 'Metadata',
        'fields'    =&gt; array(
          array(
            'id'    =&gt; 'icon',
            'title' =&gt; 'Icon',
            'type'  =&gt; 'file'
          )
        )
      )
    )
  );

  return $groups;
}
add_filter( 'kc_term_settings', 'my_category_metadata' );
</pre>
<p>Now we can attach an image when creating/editing a term:<br />
<div id="attachment_156" class="wp-caption aligncenter" style="width: 510px"><img src="http://kucrut.org/content/uploads/2012/01/set-term-icon.jpg" alt="" title="Set term icon" width="500" height="636" class="size-full wp-image-156" /><p class="wp-caption-text">Attach/set term icon</p></div></p>
<p>To get the data, we can use <code>get_term_meta()</code>. For example, assuming the category ID is <code>20</code>:</p>
<pre>
print_r( get_metadata('term', <span class="impo">20</span>, 'icon', true) );
</pre>
<p>&hellip;which outputs:</p>
<pre>
Array
(
  [selected] =&gt; Array
    (
      [0] =&gt; 38
    )
  [files] =&gt; Array
    (
      [0] =&gt; 38
    )
)
</pre>
<p>Next, we&#8217;ll display each term&#8217;s icon on the term list table:</p>
<pre>
function my_category_column_hack( $actions, $term ) {
  if ( $icon = get_metadata('term', $term-&gt;term_id, 'icon', true) ) {
    if ( isset($icon['selected'][0]) &#038;&#038; $img = wp_get_attachment_image( $icon['selected'][0]) )
      echo '&lt;a href="'.get_edit_post_link($icon['selected'][0]).'" class="term-icon"&gt;'.$img.'&lt;/a&gt;';
  }

  return $actions;
}
add_filter( '<span class="impo">category</span>_row_actions', 'my_category_column_hack', 10, 2 );
</pre>
<p>We&#8217;re basically done, and the term table should now display the icons of each term. However, we need to add some CSS to make it look a little bit sexier and to match the <em>Media</em> screen.</p>
<pre>
function my_admin_inline_styles() {
  $screen = get_current_screen();
  if ( $screen-&gt;base == 'edit-tags' ) { ?&gt;
&lt;style&gt;.term-icon {float:left;width:40px;height:40px;overflow:hidden;margin-right:10px} .term-icon img {max-width:100%;height:auto}&lt;/style&gt;
  &lt;?php }
}
add_action( 'admin_print_styles', 'my_admin_inline_styles', 99 );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/hacking-term-list-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Default File Permission in Linux&#8482;</title>
		<link>http://kucrut.org/setting-default-file-permission-in-linux/</link>
		<comments>http://kucrut.org/setting-default-file-permission-in-linux/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 13:18:52 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=150</guid>
		<description><![CDATA[Here&#8217;s the situation; I want every newly created file/directory in /var/www to be owned by user kucrut and group apache, and they should have read/write permissions, while all other users/groups should only have read permission. We will use ACL for this, and it&#8217;s usually installed by default. First, we need to make sure that the [...]]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s the situation; I want every newly created file/directory in <code>/var/www</code> to be owned by user <code>kucrut</code> and group <code>apache</code>, and they should have read/write permissions, while all other users/groups should only have read permission. We will use <a href="http://savannah.nongnu.org/projects/acl">ACL</a> for this, and it&#8217;s <em>usually</em> installed by default.<span id="more-150"></span></p>
<p>First, we need to make sure that the partition which the <code>/var/www</code> directory resides (usually <code>/</code>has ACL enabled. The <code>/etc/fstab</code> line should look like this:</p>
<pre>
<span class="ccomment"># Partition  # Mount point   # Filesystem     # Options         # Dump/pass</span>
/dev/sda5    /               ext4             noatime,acl       0 1
</pre>
<p>If acl isn&#8217;t there yet, add it, save the file, and remount the partition by running this command as root (or use <code>sudo</code>):</p>
<pre>mount -o remount /</pre>
<p>If you can&#8217;t remount the partition for whatever reason, just reboot :)</p>
<p>Now run this set of commands as root, and don&#8217;t forget to change <code>kucrut</code> and <code>apache</code> to the desired username and group respectively:</p>
<pre>
<span class="ccomment"># Set ownership</span>
chown -R kucrut:apache /var/www

<span class="ccomment"># Set permission</span>
chmod -R g+ws /var/www

<span class="ccomment"># Set default permission for newly created files/directories</span>
setfacl -R -d -m g::rwx /var/www
setfacl -R -d -m o::rx /var/www
</pre>
<p>&#8230; and we&#8217;re done.</p>
<p>Try creating a new file and check its permission:</p>
<pre>
touch /var/www/xyz &amp;&amp; ls -l /var/www/xyz
-rw-rw-r-- 1 kucrut apache 0 2012-01-08 /var/www/xyz
</pre>
<p>Source: <a href="http://www.linuxquestions.org/questions/linux-desktop-74/applying-default-permissions-for-newly-created-files-within-a-specific-folder-605129/">LinuxQuestions.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/setting-default-file-permission-in-linux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Midori</title>
		<link>http://kucrut.org/midori/</link>
		<comments>http://kucrut.org/midori/#comments</comments>
		<pubDate>Sat, 07 Jan 2012 17:40:36 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=148</guid>
		<description><![CDATA[Did you know that Midori is way ahead of Chrom(e&#124;ium) (and Firefox for that matter), and just slightly behind Opera in term of HTML5 input types support?]]></description>
				<content:encoded><![CDATA[<p>Did you know that <a href="http://en.wikipedia.org/wiki/Midori_(web_browser)">Midori</a> is way ahead of Chrom(e|ium) (and Firefox for that matter), and just slightly behind Opera in term of HTML5 input types support?</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/midori/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Panel to Debug Bar</title>
		<link>http://kucrut.org/add-panel-to-debug-bar/</link>
		<comments>http://kucrut.org/add-panel-to-debug-bar/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 13:02:27 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=142</guid>
		<description><![CDATA[We all have WP_DEBUG enabled and use Debug Bar when developing WordPress plugins and themes, right? Here&#8217;s how I added my own panel. class myDebugPanel { function title() { return 'My Debug'; } function prerender() {} function is_visible() { return true; } function render() { echo '&#60;pre&#62;Panel content....&#60;/pre&#62;'; } } The class should be easy [...]]]></description>
				<content:encoded><![CDATA[<p>We all have <code>WP_DEBUG</code> enabled and use <a href="http://wordpress.org/extend/plugins/debug-bar/">Debug Bar</a> when developing WordPress plugins and themes, right? Here&#8217;s how I added my own panel.</p>
<p><a href="http://kucrut.org/content/uploads/2012/01/debug-bar-panel.jpg"><img src="http://kucrut.org/content/uploads/2012/01/debug-bar-panel-600x225.jpg" alt="Debug Bar Panel" width="600" height="225" class="aligncenter size-large wp-image-143" /></a></p>
<p><span id="more-142"></span></p>
<pre>
class myDebugPanel {
  function title() {
    return 'My Debug';
  }

  function prerender() {}

  function is_visible() {
    return true;
  }

  function render() {
    echo '&lt;pre&gt;Panel content....&lt;/pre&gt;';
  }
}
</pre>
<p>The class should be easy to understand, and don&#8217;t remove the <code>prerender()</code> method, it&#8217;s needed by Debug Bar when adding our panel.</p>
<p>Next, we&#8217;ll inject our new panel into Debug Bar panels collection, and we&#8217;re done.</p>
<pre>
function my_debug_panel_insert( $panels ) {
  $panels[] = new myDebugPanel;
  return $panels;
}
add_filter( 'debug_bar_panels', 'my_debug_panel_insert' );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/add-panel-to-debug-bar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Customize post type archive order</title>
		<link>http://kucrut.org/customize-post-type-archive-order/</link>
		<comments>http://kucrut.org/customize-post-type-archive-order/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 13:42:15 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Hook]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=140</guid>
		<description><![CDATA[By now you&#8217;re probably already familiar with one of WordPress&#8217; most loved features, custom post type. A custom post type could be hierarchical (like page) or non-hierarchical (like post). This snippet will modify the default posts order when the post type archive is being displayed. Note: Instead of adding these snippets into your theme&#8217;s functions.php [...]]]></description>
				<content:encoded><![CDATA[<p>By now you&#8217;re probably already familiar with one of WordPress&#8217; most loved features, <a href="http://codex.wordpress.org/Post_Types">custom post type</a>. A custom post type could be hierarchical (like <code>page</code>) or non-hierarchical (like <code>post</code>). This snippet will modify the default posts order when the post type archive is being displayed.<span id="more-140"></span></p>
<p><strong>Note:</strong><br />
Instead of adding these snippets into your theme&#8217;s <code>functions.php</code> file, I <em>really</em> recommend creating a <a href="http://codex.wordpress.org/Must_Use_Plugins">mu-plugin</a> file, so you will always get the functionality, no matter what theme you&#8217;re currently using (IMO, themes shouldn&#8217;t interfere with this kind of functionality anyway).</p>
<h2>Register Post Type</h2>
<p>For this to work, there are three things we need to pay attention to when <a href="http://codex.wordpress.org/Function_Reference/register_post_type">registering</a> our post type; it has to be set to <code>hierarchical</code>, it has to support <code>page-attributes</code>, and it has to support archive.</p>
<pre>
function my_custom_post_types_register() {
  register_post_type('work', array(
    'labels'        =&gt; array('name' =&gt; __('Works'), 'singular_name' =&gt; __('Work')),
    'public'        =&gt; true,
    <span class="impo">'hierarchical'</span>  =&gt; <span class="impo">true</span>,
    <span class="impo">'supports'</span>      =&gt; array('title', 'editor', 'thumbnail', <span class="impo">'page-attributes'</span>),
    <span class="impo">'has_archive'</span>   =&gt; <span class="impo">true</span>,
    'rewrite'       =&gt; array('slug' =&gt; 'work', 'with_front' =&gt; false)
  ));
}
add_action( 'init', 'my_custom_post_types_register' );
</pre>
<h2>Customize archive order</h2>
<pre>
function my_custom_archive_order( $vars ) {
  if ( !is_admin() &#038;&#038; isset($vars['post_type']) &#038;&#038; is_post_type_hierarchical($vars['post_type']) ) {
    $vars['orderby'] = 'menu_order';
    $vars['order'] = 'ASC';
  }

  return $vars;
}
add_filter( 'request', 'my_custom_archive_order');
</pre>
<p>The code should be pretty self-explanatory; we will only modify the order if we&#8217;re on the front-end, and we&#8217;re viewing a hierarchical post type archive.</p>
<p><em>Actually</em>, the hierarchical mode is not really needed for this, since custom-ordering posts can always be done if the post type supports <code>page-attributes</code>. However, IMO, custom order doesn&#8217;t really make sense for non-hierarchical posts, don&#8217;t you think? :)</p>
<p>If you don&#8217;t want to set the post type to hierarchical, just replace the third logic in <code>my_custom_archive_order</code>, so it would check if the post type supports <code>page-attributes</code>:</p>
<pre>
if ( !is_admin() &#038;&#038; isset($vars['post_type']) &#038;&#038; post_type_supports($vars['post_type'], 'page-attributes') ) {
<span class="ccomment">//...</span>
</pre>
<p>To reorder the posts, you can manually edit their orders one by one, or use this <a href="http://wordpress.org/extend/plugins/simple-page-ordering/">plugin</a> (only if you don&#8217;t have/need child pages, since it doesn&#8217;t support it yet).</p>
<p>Example? Try <a href="http://kucrut.org/work/">this</a> :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/customize-post-type-archive-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RMS</title>
		<link>http://kucrut.org/rms/</link>
		<comments>http://kucrut.org/rms/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 02:42:53 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[F|OSS]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=117</guid>
		<description><![CDATA[Richard Stallman Was Right All Along]]></description>
				<content:encoded><![CDATA[<p><a href="http://www.osnews.com/story/25469/Richard_Stallman_Was_Right_All_Along">Richard Stallman Was Right All Along</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/rms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reminder: Laptop Mode Tools for 3.1.x kernels</title>
		<link>http://kucrut.org/reminder-laptop-mode-tools-for-3-1-x-kernels/</link>
		<comments>http://kucrut.org/reminder-laptop-mode-tools-for-3-1-x-kernels/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 13:19:12 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[F|OSS]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=113</guid>
		<description><![CDATA[If laptop mode tools service won&#8217;t start and you&#8217;re running a 3.1.x kernel, just add the kernel version in /usr/sbin/laptop_mode line ~ 500, so it should look: case "$KLEVEL" in "2.4" ) ;; "2.6" ) ;; "3.0" ) ;; "3.1" ) ;; Don&#8217;t forget to check the file after every updates. Source: Gentoo Forums]]></description>
				<content:encoded><![CDATA[<p>If laptop mode tools service won&#8217;t start and you&#8217;re running a 3.1.x kernel, just add the kernel version in <code>/usr/sbin/laptop_mode</code> line ~ 500, so it should look:</p>
<pre>
case "$KLEVEL" in
        "2.4" ) ;;
        "2.6" ) ;;
        "3.0" ) ;;
        "3.1" ) ;;
</pre>
<p>Don&#8217;t forget to check the file after every updates.</p>
<p>Source: <a href="http://forums.gentoo.org/viewtopic-t-904142.html">Gentoo Forums</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/reminder-laptop-mode-tools-for-3-1-x-kernels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smart Firefox</title>
		<link>http://kucrut.org/smart-firefox/</link>
		<comments>http://kucrut.org/smart-firefox/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 13:09:08 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[F|OSS]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=112</guid>
		<description><![CDATA[I just love the fact that Firefox remembers the directory/folder you last used to save a downloaded file from a particular site. Just select Always ask me where to save files in Preference &#187; General &#187; Downloads and you&#8217;re set. NOT in that thing called Chrom(e&#124;ium) :P]]></description>
				<content:encoded><![CDATA[<p>I just <strong>love</strong> the fact that Firefox remembers the directory/folder you last used to save a downloaded file from a particular site. Just select <em>Always ask me where to save files</em> in Preference &raquo; General &raquo; Downloads and you&#8217;re set.</p>
<p>NOT in that thing called Chrom(e|ium) :P</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/smart-firefox/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress Theme: Polos</title>
		<link>http://kucrut.org/wordpress-theme-polos/</link>
		<comments>http://kucrut.org/wordpress-theme-polos/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 03:52:52 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=110</guid>
		<description><![CDATA[So, I kinda needed a new theme for this blog and I wanted it to be minimalist, no-nonsense :D If you like it, you can use it too! Download it from GitHub (for now). I&#8217;ve submitted it to the WordPress themes official repo, and once it&#8217;s up, I&#8217;ll update this post. Found a bug or [...]]]></description>
				<content:encoded><![CDATA[<p>So, I kinda needed a new theme for this blog and I wanted it to be minimalist, no-nonsense :D</p>
<p>If you like it, you can use it too! Download it from <a href="https://github.com/kucrut/wp-theme-polos/">GitHub</a> (for now). I&#8217;ve submitted it to the WordPress themes official repo, and once it&#8217;s up, I&#8217;ll update this post.<br />
<span id="more-110"></span><br />
Found a bug or got any suggestions, feel free to leave your comments below.</p>
<p><strong>Update:</strong><br />
OH: I forgot, this theme won&#8217;t work on IE < 9 :P</p>
<p><strong>Update #2:</strong><br />
The theme is now available at <a href="http://wordpress.org/extend/themes/polos">WP Extend</a></p>
<p>Enjoy! :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/wordpress-theme-polos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Separate Comments and Pings (Trackbacks/Pingbacks)</title>
		<link>http://kucrut.org/separate-comments-and-pings-trackbacks-pingbacks/</link>
		<comments>http://kucrut.org/separate-comments-and-pings-trackbacks-pingbacks/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 10:30:40 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=108</guid>
		<description><![CDATA[When building this new theme I&#8217;m using here at kucrut.org, I wanted to separate the comments from pings. Not just give them a different style and content, but completely separate the lists. So here&#8217;s my solution, which is heavily based on the Toolbox theme. Comments template First, we need to create a comments.php template for [...]]]></description>
				<content:encoded><![CDATA[<p>When building this new theme I&#8217;m using here at kucrut.org, I wanted to separate the comments from pings. Not just give them a different style and content, but completely separate the lists. So here&#8217;s my solution, which is heavily based on the <a href="http://wordpress.org/extend/themes/toolbox">Toolbox</a> theme.<br />
<span id="more-108"></span></p>
<h2>Comments template</h2>
<p>First, we need to create a <code>comments.php</code> template for our theme.</p>
<pre>
&lt;div id="comments"&gt;
  &lt;?php if ( post_password_required() ) { ?&gt;
    &lt;p class="nopassword"&gt;&lt;?php _e('This post is password protected. Enter the password to view any comments.'); ?&gt;&lt;/p&gt;
  &lt;/div&gt;
  &lt;?php return; } ?&gt;

  &lt;?php
    if ( have_comments() ) {
      kct_response_list( get_the_ID() );
    }
    elseif ( !comments_open() &#038;&#038; !is_page() &#038;&#038; post_type_supports(get_post_type(), 'comments') ) { ?&gt;
    &lt;p class="nocomments"&gt;&lt;?php _e( 'Comments are closed.'); ?&gt;&lt;/p&gt;
  &lt;?php } ?&gt;

  &lt;?php comment_form(); ?&gt;
&lt;/div&gt;
</pre>
<p>The code says:</p>
<ul>
<li>If password is required for this post, show a message, and stop.</li>
<li>If this post have comments (all types), list them.</li>
<li>If discussion is closed, or it&#8217;s a page, or the post type doesn&#8217;t support comments, show a message.</li>
<li>Display a comment form (when applicable)</li>
</ul>
<p><code><a href="#kct_response_list">kct_response_list()</a></code> is the function that will do the listing so we will add it to our theme&#8217;s <code>functions.php</code> file. This function depend on three other functions:</p>
<ul>
<li><code><a href="#kct_get_comments_count">kct_get_comments_count()</a></code>; checks if the current post have comments with specified type,</li>
<li><code><a href="#kct_comment_list">kct_comment_list()</a></code>; lists comments, and</li>
<li><code><a href="#kct_pings_list">kct_pings_list()</a></code>; lists pings.</li>
</ul>
<p>We can even separate trackbacks and pingbacks, but I don&#8217;t think it&#8217;s necessary. The generated markup is simple but flexible enough, in case we want to create tabs for switching between comments and pings. Also, there are some handy hooks in there, in case we&#8217;d like to inject/do something interesting.</p>
<p>So, here are the functions, hope it will be useful for your projects.</p>
<h2 id="kct_get_comments_count">Get comments count</h2>
<pre>
function kct_get_comments_count( $post_id = 0, $type = '' ) {
  return count(get_comments(array(
    'post_id' =&gt; $post_id,
    'status'  =&gt; 'approve',
    'type'    =&gt; $type
  )));
}
</pre>
<h2 id="kct_comment_list">List Comments</h2>
<pre>
function kct_comment_list( $comment, $args, $depth ) {
  $GLOBALS['comment'] = $comment; ?&gt;
  &lt;li &lt;?php comment_class(); ?&gt; id="li-comment-&lt;?php comment_ID(); ?&gt;"&gt;
    &lt;article id="comment-&lt;?php comment_ID(); ?&gt;" class="comment-item"&gt;
      &lt;footer&gt;
        &lt;div class="comment-author vcard"&gt;
          &lt;?php echo get_avatar( $comment, 48 ); ?&gt;
          &lt;cite class="fn"&gt;&lt;?php comment_author_link() ?&gt;&lt;/cite&gt;
        &lt;/div&gt;

        &lt;div class="comment-meta commentmetadata"&gt;
          &lt;a href="&lt;?php echo esc_url( get_comment_link( $comment-&gt;comment_ID ) ); ?&gt;" class="comment-date"&gt;&lt;?php printf( __( '%1$s at %2$s' ), get_comment_date(), get_comment_time() ); ?&gt;&lt;/a&gt;
          &lt;?php comment_reply_link( array_merge($args, array(
            'depth'            =&gt; $depth,
            'max_depth'    =&gt; $args['max_depth'],
            'before'        =&gt; '&lt;span class="reply-link"&gt; &ndash; ',
            'after'            =&gt; '&lt;/span&gt;'
          )) ); ?&gt;
          &lt;?php edit_comment_link( __('Edit'), ' &ndash; ' ); ?&gt;
        &lt;/div&gt;
      &lt;/footer&gt;

      &lt;div class="comment-content"&gt;
        &lt;?php
          if ( $comment-&gt;comment_approved == '0' )
            echo '&lt;p&gt;&lt;em&gt;'.__('Your comment is awaiting moderation.').'&lt;/em&gt;&lt;/p&gt;';
          comment_text();
        ?&gt;
      &lt;/div&gt;
    &lt;/article&gt;
  &lt;?php
}
</pre>
<h2 id="kct_pings_list">List pings</h2>
<pre>
function kct_pings_list( $comment, $args, $depth ) {
  $GLOBALS['comment'] = $comment; ?&gt;
  &lt;li &lt;?php comment_class(); ?&gt; id="li-comment-&lt;?php comment_ID(); ?&gt;"&gt;&lt;?php comment_author_link(); ?&gt;&lt;?php edit_comment_link( __('Edit'), ' | ' ); ?&gt;
&lt;?php }
</pre>
<h2 id="kct_response_list">List all responses (comments and pings)</h2>
<pre>
function kct_response_list( $post_id = 0 ) {
  foreach ( array('comment' =&gt; __('Comments'), 'pings' =&gt; __('Pings')) as $type =&gt; $title ) {
    if ( !kct_get_comments_count($post_id, $type) )
      continue; ?&gt;
  &lt;h2 id="&lt;?php echo $type ?&gt;-title"&gt;&lt;?php echo $title ?&gt;&lt;/h2&gt;
  &lt;?php do_action( "kct_before_{$type}_list" ) ?&gt;

  &lt;ol id="&lt;?php echo $type ?&gt;list" class="responselist"&gt;
    &lt;?php wp_list_comments( array('callback' =&gt; "kct_{$type}_list", 'type' =&gt; $type) ); ?&gt;
  &lt;/ol&gt;

  &lt;?php do_action( "kct_after_{$type}_list" ) ?&gt;

  &lt;?php }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/separate-comments-and-pings-trackbacks-pingbacks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>KC Settings 2.0</title>
		<link>http://kucrut.org/kc-settings-2-0/</link>
		<comments>http://kucrut.org/kc-settings-2-0/#comments</comments>
		<pubDate>Sat, 22 Oct 2011 10:20:53 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=98</guid>
		<description><![CDATA[I just realeased version 2.0 of my KC Settings plugin a few hours ago. This release brings many bug fixes, improvements, and some cool new features. The most important new feature in this release is KC Settings Builder. Now, you don&#8217;t need to create your settings manually by writing long arrays. Instead, just go to [...]]]></description>
				<content:encoded><![CDATA[<p>I just realeased version 2.0 of my KC Settings plugin a few hours ago. This release brings many bug fixes, improvements, and some cool new features.<br />
<span id="more-98"></span><br />
The most important new feature in this release is <strong>KC Settings Builder</strong>. Now, you don&#8217;t need to create your settings manually by writing long arrays. Instead, just go to KC Settings menu under the Settings menu in your WordPress admin dashboard add create your settings there. I&#8217;ve tested this tool over and over to make sure there&#8217;s no bug left in it. But, if you think you find any, don&#8217;t hesitate to report it here, or the WP.org Support forum with tag <em>kc-settings</em>.</p>
<p>The other important new feature is the <em>file</em> field type. With this type, you can upload as much files as you want, and you can use them in your posts (multiple thumbnails, slideshow, etc), user metadata (custom local avatar), term metadata (term/category icon), or even plugin/theme (site logo, background, etc). All files that you uploaded are tracked by WordPress as usual (attachment post type), so you can also use them in your posts/pages, etc.</p>
<p>There are still quite a few features that I&#8217;d like add to this plugin, like using metaboxes for the theme/plugin setting page, more field types, etc, so if you have a brilliant idea that you need to be included in this plugin, feel free to let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/kc-settings-2-0/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>KC Media Enhancements</title>
		<link>http://kucrut.org/kc-media-enhancements/</link>
		<comments>http://kucrut.org/kc-media-enhancements/#comments</comments>
		<pubDate>Sun, 10 Apr 2011 21:53:03 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Attachment]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Taxonomy]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=91</guid>
		<description><![CDATA[Not so long ago I&#8217;ve blogged about adding some enhancements to WordPress media management, such as inserting images with custom sizes into post and setting terms for the attachments along with individual plugins for each functionality. When I released the KC Widget Enhancements plugin, I thought I should combine those plugins into one package too. [...]]]></description>
				<content:encoded><![CDATA[<p>Not so long ago I&#8217;ve blogged about adding some enhancements to WordPress media management, such as <a title="Insert Image with Custom Size into Post" href="http://kucrut.org/2011/02/insert-image-with-custom-size-into-post/">inserting images with custom sizes into post</a> and <a href="http://kucrut.org/2011/02/wordpress-attachment-category-terms/">setting terms for the attachments</a> along with individual plugins for each functionality. When I released the <a href="http://kucrut.org/2011/04/kc-widget-enhancements/">KC Widget Enhancements</a> plugin, I thought I should combine those plugins into one package too. So now I present it: <a href="http://kucrut.org/content/uploads/2011/04/kc-media-enhancements-0.1.zip">KC Media Enhancements</a>.<br />
<span id="more-91"></span><br />
<strong>Update</strong><br />
The plugin is now hosted at <a href="http://wordpress.org/extend/plugins/kc-media-enhancements/">WordPress Plugin repo</a>. Enjoy :)</p>
<p>This plugin currently provides you with the two functionalities mentioned above which you can enable/disable easily if you have <a href="http://wordpress.org/extend/plugins/kc-settings/">KC Settings</a> plugin installed. You can also modify the options using the available <code>kcme_options</code> filter (please read the FAQ section in the <code>readme.txt</code> file on how to do this).</p>
<p>The plugin is currently hosted at <a href="https://github.com/kucrut/kc-media-enhancements">GitHub</a> and will always be updated there, but it&#8217;s also in the process of approval to be hosted at WordPress plugin repo and I will update this post as soon as it&#8217;s approved and hosted there.</p>
<p>Enjoy the plugin and feel free to leave a comment/bug report/ideas in the comments section below :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/kc-media-enhancements/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>KC Widget Enhancements</title>
		<link>http://kucrut.org/kc-widget-enhancements/</link>
		<comments>http://kucrut.org/kc-widget-enhancements/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 19:15:53 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Widget]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=89</guid>
		<description><![CDATA[As I promised when I wrote the functions for adding custom classes for WordPress widgets, I&#8217;m now announcing the release of KC Widget Enhancements. This plugin provides the ability to set custom classes and ID for any widgets, not just the built-in ones, but also widgets that comes with installed plugins/themes. Update: This plugin is [...]]]></description>
				<content:encoded><![CDATA[<p>As I promised when I wrote the functions for adding <a title="Add Custom Class(es) to ANY Widget" href="http://kucrut.org/add-custom-classes-to-any-widget/">custom classes for WordPress widgets</a>, I&#8217;m now announcing the release of <strong>KC Widget Enhancements</strong>. This plugin provides the ability to set custom classes and ID for any widgets, not just the built-in ones, but also widgets that comes with installed plugins/themes.<br />
<span id="more-89"></span><br />
<strong>Update:</strong><br />
This plugin is now hosted at <a href="http://wordpress.org/extend/plugins/kc-widget-enhancements/">WordPress plugin repo</a> so you can install it directly from the admin dashboard.</p>
<p>Currently there are three components, but I designed this plugin to be extendable so it should be easy to add more in the future:</p>
<ul>
<li>Custom widget ID</li>
<li>Custom widget classes</li>
<li>Enable shortcode on text widgets</li>
</ul>
<p>If you have idea on how to enhance the widgets even more, please don&#8217;t hesitate to leave a comment below. I may add them in the next versions.</p>
<p>To get the most of this plugin, I highly suggest the use of <a title="KC Settings" href="http://wordpress.org/extend/plugins/kc-settings/">KC Settings</a> together with this plugin so you can enable/disable the components easily. Or if you prefer to do it the geeky way, please read FAQ section in the <code>readme.txt</code> file.</p>
<p>You can download this plugin from <a href="http://kucrut.org/content/uploads/2011/04/kc-widget-enhancements-0.1.zip">here</a> or clone/fork it from <a href="https://github.com/kucrut/kc-widget-enhancements">github</a>. I&#8217;ll update this post when it&#8217;s available on WordPress&#8217; plugins repo.</p>
<p><strong>Notes:</strong><br />
As <a href="http://kucrut.org/2010/11/add-custom-classes-to-any-widget/#comment-57">reported</a> by Ed Nailor, the custom ID/classes won&#8217;t get printed if you&#8217;re using <a href="http://wordpress.org/extend/plugins/widget-logic/">Widget Logic</a> plugin, because it overrides the default callback for each widget.</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/kc-widget-enhancements/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Remove Protected Post Title Prefix</title>
		<link>http://kucrut.org/remove-protected-post-title-prefix/</link>
		<comments>http://kucrut.org/remove-protected-post-title-prefix/#comments</comments>
		<pubDate>Sat, 26 Mar 2011 17:36:05 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Filter]]></category>
		<category><![CDATA[Hook]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=88</guid>
		<description><![CDATA[By default, WordPress will prefix protected post&#8217;s title with Protected. This is good when the password hasn&#8217;t been supplied. Unfortunately, it doesn&#8217;t remove this prefix when the correct password has been supplied which is not good IMO. Here&#8217;s a snippet to &#8216;fix&#8217; this behavior: function kc_protected_title_format( $format ) { if ( !post_password_required() ) $format = [...]]]></description>
				<content:encoded><![CDATA[<p>By default, WordPress will prefix protected post&#8217;s title with <em>Protected</em>. This is good when the password hasn&#8217;t been supplied. Unfortunately, it doesn&#8217;t remove this prefix when the correct password has been supplied which is not good IMO. Here&#8217;s a snippet to &#8216;fix&#8217; this behavior:<br />
<span id="more-88"></span></p>
<pre>
function kc_protected_title_format( $format ) {
	if ( !post_password_required() )
		$format = '%s';

	return $format;
}
add_filter( 'protected_title_format', 'kc_protected_title_format' );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/remove-protected-post-title-prefix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reminder: add_action</title>
		<link>http://kucrut.org/reminder-add_action/</link>
		<comments>http://kucrut.org/reminder-add_action/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 13:08:38 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Hook]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=85</guid>
		<description><![CDATA[Just a quick reminder, when dynamically adding an action inside an action callback for the same hook, don&#8217;t forget to use lower priority for the action you just added. add_action( 'init', 'my_fuction' ); function my_fuction( $args ) { // ... add_action( 'init', 'my_other_function', 11 ); }]]></description>
				<content:encoded><![CDATA[<p>Just a quick reminder, when dynamically adding an action inside an action callback for the <em>same hook</em>, don&#8217;t forget to use <em>lower</em> priority for the action you just added.</p>
<pre>
add_action( 'init', 'my_fuction' );
function my_fuction( $args ) {
    <span class="ccomment">// ...</span>
    add_action( 'init', 'my_other_function', 11 );
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/reminder-add_action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Insert Image with Custom Size into Post</title>
		<link>http://kucrut.org/insert-image-with-custom-size-into-post/</link>
		<comments>http://kucrut.org/insert-image-with-custom-size-into-post/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 12:21:09 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Attachment]]></category>
		<category><![CDATA[Hook]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=75</guid>
		<description><![CDATA[Since version 2.9, WordPress provided a new function, add_image_size() to define additional image sizes along with the three default sizes: Thumbnail, Medium and Large. After defining the additional sizes, we can use them in our themes either using the_post_thumbnail(), wp_get_attachment_image(), or any other functions that suit your needs. Update I&#8217;ve created a plugin for this [...]]]></description>
				<content:encoded><![CDATA[<p>Since version 2.9, WordPress provided a new function, <a href="http://codex.wordpress.org/Function_Reference/add_image_size">add_image_size()</a> to define additional image sizes along with the three default sizes: <em>Thumbnail</em>, <em>Medium</em> and <em>Large</em>. After defining the additional sizes, we can use them in our themes either using <a href="http://codex.wordpress.org/Function_Reference/the_post_thumbnail">the_post_thumbnail()</a>, <a href="http://codex.wordpress.org/Function_Reference/wp_get_attachment_image">wp_get_attachment_image()</a>, or any other <a href="http://codex.wordpress.org/Function_Reference">functions</a> that suit your needs.<br />
<span id="more-75"></span><br />
<strong>Update</strong><br />
I&#8217;ve created a plugin for this so you won&#8217;t need to edit your theme/plugin files anymore :) Download it from <a href="http://wordpress.org/extend/plugins/kc-media-enhancements/">WordPress plugins repo</a>.</p>
<pre>function my_insert_custom_image_sizes( $sizes ) {
  global $_wp_additional_image_sizes;
  if ( empty($_wp_additional_image_sizes) )
    return $sizes;

  foreach ( $_wp_additional_image_sizes as $id => $data ) {
    if ( !isset($sizes[$id]) )
      $sizes[$id] = ucfirst( str_replace( '-', ' ', $id ) );
  }

  return $sizes;
}
add_filter( 'image_size_names_choose', 'my_insert_custom_image_sizes' );
</pre>
<div id="attachment_191" class="wp-caption aligncenter" style="width: 735px"><a href="http://kucrut.org/content/uploads/2011/02/insert-image2.png"><img src="http://kucrut.org/content/uploads/2011/02/insert-image2.png" alt="" title="Insert custom size image" width="725" height="943" class="size-full wp-image-191" /></a><p class="wp-caption-text">The result</p></div>
<p><strong>Note</strong>: The new code is adapted from <a href="http://www.wpmayor.com/wordpress-hacks/how-to-add-custom-image-sizes-to-wordpress-uploader/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/insert-image-with-custom-size-into-post/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Unique post category/term</title>
		<link>http://kucrut.org/unique-post-category-term/</link>
		<comments>http://kucrut.org/unique-post-category-term/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 22:26:45 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Hook]]></category>
		<category><![CDATA[Taxonomy]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=72</guid>
		<description><![CDATA[In WordPress, we can set multiple categories/terms for a post. This is true for both hierarchical taxonomies (ex: category) and non-hierarchical taxonomies (ex: post_tag). However, on a project I&#8217;ve worked on, the client wanted me to make the category metabox to use radio inputs (exactly like WordPress&#8217; new post format feature) instead of checkboxes to [...]]]></description>
				<content:encoded><![CDATA[<p>In WordPress, we can set multiple categories/terms for a post. This is true for both hierarchical taxonomies (ex: <code>category</code>) and non-hierarchical taxonomies (ex: <code>post_tag</code>). However, on a project I&#8217;ve worked on, the client wanted me to make the category metabox to use radio inputs (exactly like WordPress&#8217; new <a href="http://andrewnacin.com/2011/01/27/on-standardized-post-formats/">post format</a> feature) instead of checkboxes to prevent the editor from setting multiple categories for the post (s)he writes. This request forced me :) to come up with a solution. I was also inspired by Justin Tadlock&#8217;s <a href="http://justintadlock.com/archives/2011/01/14/rethinking-how-news-themes-work/">idea</a> on using a taxonomy for theme layout. Here&#8217;s my solution in hope it could be useful for others.<br />
<span id="more-72"></span></p>
<h2>The result</h2>
<div id="attachment_73" class="wp-caption aligncenter" style="width: 295px"><img src="http://kucrut.org/content/uploads/2011/02/unique-taxonomy-metabox.jpg" alt="Unique Taxonomy Metabox" title="Unique Taxonomy Metabox" width="285" height="220" class="size-full wp-image-73" /><p class="wp-caption-text">Unique Taxonomy Metabox</p></div>
<h2>The code</h2>
<p>As usual, you can either add this code to your theme&#8217;s <code>function.php</code> file or create a new php file for it and place it inside <code>wp-content/mu-plugins</code> directory (preferred) so you can always have this feature no matter what theme you&#8217;re using.</p>
<pre>
&lt;?php
function kc_unique_taxonomies() {
	$unique_taxonomies = apply_filters( 'kc_unique_taxonomies', array() );
	if ( empty($unique_taxonomies) )
		return;

	foreach ( $unique_taxonomies as $tax_name ) {
		$taxonomy = get_taxonomy( $tax_name );
		if ( !$taxonomy-&gt;hierarchical || !$taxonomy-&gt;show_ui || empty($taxonomy-&gt;object_type) )
			continue;

		foreach ( $taxonomy-&gt;object_type as $pt ) {
			# Remove default metabox
			remove_meta_box( "{$tax_name}div", $pt, 'side' );

			# Add our own
			add_meta_box( "unique-{$tax_name}-div", $taxonomy-&gt;labels-&gt;singular_name, 'kc_unique_taxonomies_metabox', $pt, 'side', 'low', array('taxonomy' =&gt; $tax_name) );
		}
	}
}
add_action( 'admin_menu', 'kc_unique_taxonomies' );


function kc_terms_radiolist( $post_id, $taxonomy, $echo = true ) {
	$terms = get_terms( $taxonomy, array('hide_empty' =&gt; false) );
	if ( empty($terms) )
		return;
	$name = ( $taxonomy == 'category' ) ? 'post_category' : "tax_input[{$taxonomy}]";

	$post_terms = get_the_terms( $post_id, $taxonomy );
	$nu_post_terms = array();
	if ( !empty($post_terms) ) {
		foreach ( $post_terms as $post_term )
			$nu_post_terms[] = $post_term-&gt;term_id;
	}

	$output = '';
	foreach ( $terms as $term ) {
		$output .= "&lt;li class='selectit'&gt;";
		$output .= "&lt;label&gt;";
		$output .= "&lt;input type='radio' name='{$name}[]' value='{$term-&gt;term_id}' ".checked( in_array($term-&gt;term_id, $nu_post_terms), true, false )."/&gt;";
		$output .= " {$term-&gt;name}&lt;/label&gt;";
		$output .= "&lt;/li&gt;\n";
	}

	if ( $echo )
		echo $output;
	else
		return $output;
}

function kc_unique_taxonomies_metabox( $post, $box ) {
	if ( !isset($box['args']) || !is_array($box['args']) )
		$args = array();
	else
		$args = $box['args'];

	$defaults = array('taxonomy' =&gt; 'category');
	extract( wp_parse_args($args, $defaults), EXTR_SKIP );
	$tax = get_taxonomy($taxonomy);

	?&gt;
	&lt;div id="taxonomy-&lt;?php echo $taxonomy; ?&gt;" class="categorydiv"&gt;
		&lt;?php
			$name = ( $taxonomy == 'category' ) ? 'post_category' : 'tax_input[' . $taxonomy . ']';
			echo "&lt;input type='hidden' name='{$name}' value='0' /&gt;"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
		?&gt;
		&lt;ul id="&lt;?php echo $taxonomy; ?&gt;checklist" class="list:&lt;?php echo $taxonomy?&gt; categorychecklist form-no-clear"&gt;
			&lt;?php kc_terms_radiolist( $post-&gt;ID, $taxonomy ) ?&gt;
		&lt;/ul&gt;
	&lt;?php if ( !current_user_can($tax-&gt;cap-&gt;assign_terms) ) { ?&gt;
		&lt;p&gt;&lt;em&gt;&lt;?php _e('You cannot modify this taxonomy.'); ?&gt;&lt;/em&gt;&lt;/p&gt;
	&lt;?php } ?&gt;
	&lt;?php if ( current_user_can($tax-&gt;cap-&gt;edit_terms) ) { ?&gt;
			&lt;div id="&lt;?php echo $taxonomy; ?&gt;-adder" class="wp-hidden-children"&gt;
				&lt;h4&gt;
					&lt;a id="&lt;?php echo $taxonomy; ?&gt;-add-toggle" href="#&lt;?php echo $taxonomy; ?&gt;-add" class="hide-if-no-js" tabindex="3"&gt;
						&lt;?php
							/* translators: %s: add new taxonomy label */
							printf( __( '+ %s' ), $tax-&gt;labels-&gt;add_new_item );
						?&gt;
					&lt;/a&gt;
				&lt;/h4&gt;
				&lt;p id="&lt;?php echo $taxonomy; ?&gt;-add" class="category-add wp-hidden-child"&gt;
					&lt;label class="screen-reader-text" for="new&lt;?php echo $taxonomy; ?&gt;"&gt;&lt;?php echo $tax-&gt;labels-&gt;add_new_item; ?&gt;&lt;/label&gt;
					&lt;input type="text" name="new&lt;?php echo $taxonomy; ?&gt;" id="new&lt;?php echo $taxonomy; ?&gt;" class="form-required form-input-tip" value="&lt;?php echo esc_attr( $tax-&gt;labels-&gt;new_item_name ); ?&gt;" tabindex="3" aria-required="true"/&gt;
					&lt;label class="screen-reader-text" for="new&lt;?php echo $taxonomy; ?&gt;_parent"&gt;
						&lt;?php echo $tax-&gt;labels-&gt;parent_item_colon; ?&gt;
					&lt;/label&gt;
					&lt;input type="button" id="&lt;?php echo $taxonomy; ?&gt;-add-submit" class="add:&lt;?php echo $taxonomy ?&gt;checklist:&lt;?php echo $taxonomy ?&gt;-add button category-add-sumbit" value="&lt;?php echo esc_attr( $tax-&gt;labels-&gt;add_new_item ); ?&gt;" tabindex="3" /&gt;
					&lt;?php wp_nonce_field( 'add-'.$taxonomy, '_ajax_nonce-add-'.$taxonomy, false ); ?&gt;
					&lt;span id="&lt;?php echo $taxonomy; ?&gt;-ajax-response"&gt;&lt;/span&gt;
				&lt;/p&gt;
			&lt;/div&gt;
		&lt;?php } ?&gt;
	&lt;/div&gt;
&lt;?php } ?&gt;
</pre>
<h2>The explanation</h2>
<p>The first function &#8212; <code>kc_unique_taxonomies</code> &#8212; will find if you have set a taxonomy (or more) to be unique. You will have to add the taxonomy IDs using the available <code>kc_unique_taxonomies</code> filter hook (we&#8217;ll talk about it shortly). If there&#8217;s a unique taxonomy found, it will then remove the taxonomy&#8217;s default metabox in the post editing page, and replace it with the new one.</p>
<p><strong>Note:</strong><br />
This function will only search for <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy">hierarchical</a> taxonomies, because I strongly believe that a post should be allowed to have multiple non-hierachical taxonomy terms (ex: tags). Also, non-public and orphan taxonomies (taxonomies that are not attached to a post type) will be ignored.</p>
<p>The second function &#8212; <code>kc_terms_radiolist</code> &#8212; will display the replacement metaboxes for each unique taxonomies that use radio inputs for the taxonomy&#8217;s terms. I basically just took WordPress default category metabox and adjusted some parts of it.</p>
<h2>Usage</h2>
<p>The last step is to actually set some taxonomies to be unique which you can either do from your theme or plugin. Just add this snippet of code:</p>
<pre>
function my_unique_taxonomies( $arr ) {
	$unique_taxonomies = array( 'category' );
	return array_merge( $arr, $unique_taxonomies );
}
add_filter( 'kc_unique_taxonomies', 'my_unique_taxonomies' );
</pre>
<p>You can add more taxonomies to the <code>$unique_taxonomies</code> array if you want.</p>
<p>Bugs, question? feel free to leave a comment below :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/unique-post-category-term/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WordPress Attachment Category/Terms</title>
		<link>http://kucrut.org/wordpress-attachment-category-terms/</link>
		<comments>http://kucrut.org/wordpress-attachment-category-terms/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 18:25:26 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Attachment]]></category>
		<category><![CDATA[Taxonomy]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=69</guid>
		<description><![CDATA[I was working on a photography site project for a dear friend of mine, Virda, and it requires me to set categories/terms for the attachment images. By default, an attachment post will inherit its parent terms, but, what if we only need to pull attachments which have certain terms? Querying their parents and then filtering [...]]]></description>
				<content:encoded><![CDATA[<p>I was working on a photography site project for a dear friend of mine, <a href="http://virda.com">Virda</a>, and it requires me to set categories/terms for the attachment images. By default, an attachment post will inherit its parent terms, but, what if we only need to pull attachments which have certain terms? Querying their parents <em>and then</em> filtering the result will surely need more time and resources don&#8217;t you think? Besides, we won&#8217;t have the freedom to set the attachments&#8217; terms without modifying their parent posts.<br />
<span id="more-69"></span><br />
<strong>Update:</strong><br />
I&#8217;ve updated the code (fixes/cleanups, enhancements) and create a complete WordPress plugin for it with i18n support. You can <a href="http://kucrut.org/content/uploads/2011/02/kc-attachment-taxonomies-0.1.zip">download it here</a>. I&#8217;ll submit this plugin to the repository and will update this post when it&#8217;s live.</p>
<p><strong>Update 2:</strong><br />
I&#8217;ve created a plugin for this so you won&#8217;t need to edit your theme/plugin files anymore :) Download it from <a href="http://wordpress.org/extend/plugins/kc-media-enhancements/">WordPress plugins repo</a>.</p>
<p>So I searched for a solution on the interweb and found the closest one to my liking at <a href="http://wordpress.stackexchange.com/questions/496/can-i-add-a-category-metabox-to-attachment">WP StackExchange</a> which is now available as a <a href="http://suburbia.org.uk/page/projects.html#wos_media_categories">plugin</a>. Unfortunately, this solution needs javascript (jQuery) which in my opinion should be avoided for this kind of things. So I began learning the code and modify it to suit my needs.</p>
<p>As usual, you can add these codes to your theme&#8217;s <code>function.php</code> file, or you can create a new php file and place it inside the <code>wp-content/mu-plugins</code> directory (create it if it doesn&#8217;t exist yet). The second method is preferable so you&#8217;ll still have this functionality no matter what theme you&#8217;re using.</p>
<p>OK, let&#8217;s get started.</p>
<h2>Register attachment taxonomies</h2>
<pre>
function kc_attachment_taxonomies() {
	$taxonomies = array( 'category', 'post_tag' );
	foreach ( $taxonomies as $tax )
		register_taxonomy_for_object_type( $tax, 'attachment' );
}
add_action( 'init', 'kc_attachment_taxonomies' );
</pre>
<p>The code above will register <code>category</code> and <code>post_tag</code> taxonomies for the attachment. You can add more taxonomies to the array if you like, but you&#8217;ll have to <a href="http://codex.wordpress.org/Function_Reference/register_taxonomy">register</a> them beforehand.</p>
<p><strong>Note:</strong><br />
You can also hook <code>kc_attachment_taxonomies</code> function into <code>admin_init</code> to reduce function calls when WordPress is loaded on the frontend, but you won&#8217;t be able to get any result when calling <code>get_attachment_taxonomies()</code> on the frontend.</p>
<h2>Attachment fields</h2>
<pre>
function kc_attachment_fields_to_edit( $fields, $post ) {
	$taxonomies = get_attachment_taxonomies( $post );
	if ( empty($taxonomies) )
		return $fields;

	foreach ( $taxonomies as $tax ) {
		$tax_object = (array) get_taxonomy( $tax );
		if ( !$tax_object['public'] )
			continue;
		if ( empty($tax_object['label']) )
			$tax_object['label'] = $tax;
		if ( empty($t['args']) )
			$tax_object['args'] = array();

		$att_terms = array();
		$post_terms = get_object_term_cache( $post->ID, $tax );
		if ( empty($post_terms) )
			$post_terms = wp_get_object_terms( $post->ID, $tax, $tax_object['args'] );
		if ( !empty($post_terms) )
			foreach ( $post_terms as $post_term )
				$att_terms[$post_term->term_id] = $post_term->name;

		$tax_terms = get_terms( $tax, array('hide_empty' => false) );

		$html = "&lt;ul class='attachment-terms-list'>\n";

		if ( !empty($tax_terms) )
			foreach ( $tax_terms as $term )
				$html .= "\t&lt;li>&lt;label>&lt;input type='checkbox' name='attachments[{$post->ID}][{$tax}][]' value='{$term->name}' ".checked(array_key_exists($term->term_id, $att_terms), true, false)." /> {$term->name}&lt;/label>&lt;/li>\n";

		$html .= "\t&lt;li>&lt;input type='text' name='attachments[{$post->ID}][{$tax}][]' />&lt;/label>&lt;/li>\n";
		$html .= "&lt;/ul>\n";


		$fields[$tax]['input'] = 'html';
		$fields[$tax]['html'] = $html;
		$fields[$tax]['helps'] = __( sprintf('Check/uncheck existing %s, or add new one(s), separated by commas.', $fields[$tax]['label']) );
	}

	return $fields;
}
add_filter( 'attachment_fields_to_edit', 'kc_attachment_fields_to_edit', 10, 2 );
</pre>
<p>By default, when we registered a taxonomy for the attachment post_type, WordPress will add an input field in the attachment form. We can then fill it with the term names (separated by commas) and WordPress will set them for the attachment. This is not cool, because we&#8217;ll have to remember exactly the term names we want to set for the attachment, otherwise, a new term will be created each time we made a typo :)</p>
<p>The function above will create a list of existing term names from each taxonomy and also an empty input field in case you need to add a new term.<br />
<div id="attachment_70" class="wp-caption aligncenter" style="width: 310px"><a href="http://kucrut.org/content/uploads/2011/02/term-list-on-attachment-form.jpg"><img src="http://kucrut.org/content/uploads/2011/02/term-list-on-attachment-form-300x220.jpg" alt="Attachment form" title="Attachment form" width="300" height="220" class="size-medium wp-image-70" /></a><p class="wp-caption-text">Attachment form with term list</p></div></p>
<h2>Attachment data</h2>
<pre lang="php">
function kc_attachment_fields_data() {
	if ( empty($_POST['attachments']) )
		return;

	foreach ( $_POST['attachments'] as $id => $data ) {
		$taxonomies = get_attachment_taxonomies( $id );
		if ( empty($taxonomies) )
			continue;

		foreach ( $taxonomies as $tax )
			if ( isset($data[$tax]) )
				$_POST['attachments'][$id][$tax] = trim( join(',', $data[$tax]) );
	}
}
add_action( 'init', 'kc_attachment_fields_data' );
</pre>
<p>The last step is to intercept the posted data when we save the attachment. When saving the attachment data, WordPress expects the terms data as a string which will be converted to an array. But, because we&#8217;ve already modified the field, the terms data is sent as an array. I tried to find a filter hook to modify the data, but unfortunately it&#8217;s not available (yet), so we need to use the <code>init</code> hook to modify it. Don&#8217;t worry though, the function will exit as soon as it found out that the <code>$_POST</code> data doesn&#8217;t contain what it needs, so it won&#8217;t waste your server&#8217;s CPU cycle :)</p>
<p><code>kc_attachment_fields_data</code>&#8216;s job is pretty simple; take each attachment&#8217;s term data for each taxonomy and convert it to a string by separating each term with a comma, and then give it back to <code>$_POST</code> so WordPress can use it when updating the attachments.</p>
<p><strong>Done!</strong></p>
<h2>Usage</h2>
<p>To pull attachments from certain categories/terms, we can use what we usually use to pull ordinary posts/pages, either <a href="http://codex.wordpress.org/Function_Reference/query_posts">query_posts</a>, <a href="http://codex.wordpress.org/Function_Reference/get_posts">get_posts</a>, or even better, <a href="http://codex.wordpress.org/Function_Reference/WP_Query">WP_Query</a> class. To keep it simple, we&#8217;ll use <code>get_posts</code>, for the example:</p>
<pre>
$images = get_posts( array('post_type' => 'attachment', 'category__in' => array(1,5,6,7))  );
if ( !empty($images) ) {
	foreach ( $images as $image ) {
		echo wp_get_attachment_image($image->ID).'&lt;br />';
		echo $image->post_title .'&lt;br />';
	}
}
</pre>
<p>That should give you some attachment images that are member of categories 1, 5, 6 and 7 (if you have any, off course).</p>
<h2>What&#8217;s next?</h2>
<p>I&#8217;m not quite done with this. I think it&#8217;d be sweet if I could set which taxonomy should be registered for certain file types (which should be pretty simple to do I guess). I may also come up with other new ideas along the way, but for now I think it&#8217;s more than enough :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/wordpress-attachment-category-terms/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Add Custom Class(es) to ANY Widget</title>
		<link>http://kucrut.org/add-custom-classes-to-any-widget/</link>
		<comments>http://kucrut.org/add-custom-classes-to-any-widget/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 20:37:48 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Widget]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=67</guid>
		<description><![CDATA[WordPress has a powerful API for creating, configuring and displaying widgets, but one thing I really need is the ability to add custom class(es) to the widgets. Every widget should usually come with its own classname, which will be printed when the sidebar is being displayed. So, assuming you&#8217;ve used the correct method for registering [...]]]></description>
				<content:encoded><![CDATA[<p>WordPress has a powerful API for creating, configuring and displaying widgets, but one thing I really need is the ability to add custom class(es) to the widgets. Every widget should usually come with its own <code>classname</code>, which will be printed when the sidebar is being displayed. So, assuming you&#8217;ve used the correct method for <a href="http://codex.wordpress.org/Function_Reference/register_sidebar">registering sidebar</a>, you can add these following functions to your theme/plugin to provide the user the ability to add custom class(es) to the widgets.<br />
<span id="more-67"></span><br />
<strong>Update</strong><br />
I&#8217;ve created a plugin for this so you won&#8217;t need to edit your theme/plugin files anymore :) Download it from <a href="http://wordpress.org/extend/plugins/kc-widget-enhancements/">WordPress plugins repo</a>.</p>
<p>There are three steps involved:</p>
<ol>
<li><a href="#widget-form">Adding an input field on the widget configuration form</a></li>
<li><a href="#widget-update">Updating the widget options</a></li>
<li><a href="#widget-markup">Adding our custom class(es) to the widget markup</a></li>
</ol>
<h2 id="widget-form">Adding an input field on the widget configuration form</h2>
<pre>
function kc_widget_form_extend( $instance, $widget ) {
	if ( !isset($instance['classes']) )
		$instance['classes'] = null;

	$row = "&lt;p>\n";
	$row .= "\t&lt;label for='widget-{$widget->id_base}-{$widget->number}-classes'>Additional Classes &lt;small>(separate with spaces)&lt;/small>&lt;/label>\n";
	$row .= "\t&lt;input type='text' name='widget-{$widget->id_base}[{$widget->number}][classes]' id='widget-{$widget->id_base}-{$widget->number}-classes' class='widefat' value='{$instance['classes']}'/>\n";
	$row .= "&lt;/p>\n";

	echo $row;
	return $instance;
}
add_filter('widget_form_callback', 'kc_widget_form_extend', 10, 2);
</pre>
<p>The <code>kc_widget_form_extend()</code> simply adds a new input field on the widget configuration form. You can add another field here if you&#8217;re feeling adventurous :)</p>
<h2 id="widget-update">Updating the widget options</h2>
<pre>
function kc_widget_update( $instance, $new_instance ) {
	$instance['classes'] = $new_instance['classes'];
	return $instance;
}
add_filter( 'widget_update_callback', 'kc_widget_update', 10, 2 );
</pre>
<p>The <code>kc_widget_update()</code> functions added a new option to the widget which will be saved to the database when you hit the <em>Save</em> button.</p>
<h2 id="widget-markup">Adding our custom class(es) to the widget markup</h2>
<pre lang="php">
function kc_dynamic_sidebar_params( $params ) {
	global $wp_registered_widgets;
	$widget_id	= $params[0]['widget_id'];
	$widget_obj	= $wp_registered_widgets[$widget_id];
	$widget_opt	= get_option($widget_obj['callback'][0]->option_name);
	$widget_num	= $widget_obj['params'][0]['number'];

	if ( isset($widget_opt[$widget_num]['classes']) &#038;&#038; !empty($widget_opt[$widget_num]['classes']) )
		$params[0]['before_widget'] = preg_replace( '/class="/', "class=\"{$widget_opt[$widget_num]['classes']} ", $params[0]['before_widget'], 1 );

	return $params;
}
add_filter( 'dynamic_sidebar_params', 'kc_dynamic_sidebar_params' );
</pre>
<p>The last step is to modify the widget&#8217;s markup. When you call the <code>dynamic_sidebar()</code> function, WordPress prepares the markup for every widget, including its <em>id</em> and <em>classes</em>. It took me a while to figure out a way to modify the markup and I&#8217;m not really sure that it&#8217;s the best one, but it sure does the job :)</p>
<p>First, we pull all registered widgets from the global <code>$wp_registered_widgets</code> variable. Since we don&#8217;t want to modify all widgets, we need to filter the one we want using the <code>$params</code> variable that WordPress passed to our function. When we found the widget, we&#8217;ll check if it has custom class(es) added, and then add them to its markup.</p>
<p>Now you can use those custom classes in your stylesheet to give your widgets some unique look n&#8217; feel :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/add-custom-classes-to-any-widget/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Temporary Fix for Regenerate Thumbnails 2.0.3</title>
		<link>http://kucrut.org/regenerate-thumbnails-203-temporary-fix/</link>
		<comments>http://kucrut.org/regenerate-thumbnails-203-temporary-fix/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 12:21:42 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=65</guid>
		<description><![CDATA[I was building a WordPress a theme, and I needed to rebuild the post attachment thumbnails. As usual, I used Alex&#8217; amazing Regenerate Thumbnails plugin. Upon clicking the button, I got nothing. No progressbar, nothing. I checked the attachment directory and found that the thumbnails weren&#8217;t rebuilt. So I looked at Firebug console and found [...]]]></description>
				<content:encoded><![CDATA[<p>I was building a WordPress a theme, and I needed to rebuild the post attachment thumbnails. As usual, I used <a href="http://www.viper007bond.com/">Alex&#8217;</a> amazing <a href="http://wordpress.org/extend/plugins/regenerate-thumbnails/">Regenerate Thumbnails</a> plugin. Upon clicking the button, I got nothing. No progressbar, nothing. I checked the attachment directory and found that the thumbnails weren&#8217;t rebuilt.<br />
<span id="more-65"></span><br />
So I looked at Firebug console and found an error thrown, <code>$.widget is not a function</code> and I realized that I was using the trunk version of WordPress. It throws an error because WordPress just got its jQuery and jQuery UI scripts updated to the latest versions. Also, the &#8216;widget&#8217; part of jQuery UI is now has its own handler, &#8216;<code>jquery-ui-widget</code>&#8216; while previously it was part of &#8216;<code>jquery-ui-core</code>&#8216; (<em>I believe</em>).</p>
<p>The fix is easy, you can follow these steps:</p>
<ol>
<li>Download the newest jQuery UI bundle and unpack it.</li>
<li>Copy the new <code>jquery.ui.progressbar.js</code> (located in the <code>development-bundle/ui/</code> directory) into the Regenerate Thumbnails plugin directory <code>(wp-content/plugins/regenerate-thumbnails/jquery-ui/</code>).</li>
<li>Open the plugin script (<code>regenerate-thumbnails.php</code>) with your favorite editor and edit line 59 with this:
<pre lang="php">wp_enqueue_script( 'jquery-ui-progressbar', plugins_url( 'jquery-ui/jquery.ui.progressbar.js', __FILE__ ), array('jquery-ui-core', 'jquery-ui-widget'), '1.8.5' );</pre>
</li>
<li>Now you can rebuild your thumbnails.</li>
</ol>
<p>Because this problem only occur when running the trunk version of WordPress, I don&#8217;t think the plugin needs to be updated (yet). I&#8217;m sure Alex will update it when WordPress 3.1 come out and I&#8217;ll be sure to remind him. He usually responds quickly, so no need to worry :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/regenerate-thumbnails-203-temporary-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KC Settings</title>
		<link>http://kucrut.org/kc-settings/</link>
		<comments>http://kucrut.org/kc-settings/#comments</comments>
		<pubDate>Mon, 25 Oct 2010 12:20:17 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=63</guid>
		<description><![CDATA[I&#8217;ve been writing WordPress themes for these past two years. Some of them are very simple and some others are quite complex. These themes need a settings panel so the user (or the site admin) can configure their site comfortably. There are many methods around the interwebs on how you can create such a settings [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been writing WordPress themes for these past two years. Some of them are very simple and some others are quite complex. These themes need a settings panel so the user (or the site admin) can configure their site comfortably. There are many methods around the interwebs on how you can create such a settings panel for your theme/plugin. I tried to adapt some of them into my themes, but there was always something wishpering in my ear telling me to write my own settings panel with <em>my own way</em> :) .<br />
<span id="more-63"></span><br />
The closest thing I found was the method used by <a href="http://themehybrid.com">Hybrid</a>, <a href="http://justintadlock.com">Justin Tadlock</a>&#8216;s very powerful theme framework. However, it lacks some features I need, and it&#8217;s not too comfortable to work with. I like the way it uses the metaboxes to present the options though, it&#8217;s very WordPress :)</p>
<p>So I began playing with Hybrid&#8217;s code and altered the way it handles the options, but keep the presentation intact. I got it working the way I wanted it to, until I need to add another feature (other option type and validation). I came across <a href="http://ottopress.com/2009/wordpress-settings-api-tutorial/">Otto&#8217;s article</a> about WordPress&#8217; Setting API and it inspired to rewrite the code.</p>
<p>After a few fun days, I finally got it right and made it as a plugin so everyone can use it in their project. It still lacks some features (like file upload), but (I think) the base code is easy enough to modify so it won&#8217;t take long before I add them :)</p>
<p>For you WordPress lovers out there, here I present my very first public plugin, <a href="http://gitorious.org/kc-settings">KC Settings</a>.</p>
<p><strong>Update</strong>:<br />
This plugin is now hosted at <a href="http://wordpress.org/extend/plugins/kc-settings/">WordPress plugins directory</a>.</p>
<p>I&#8217;ve included a readme.html file so you should read it before using the plugin. The documentation is not complete yet, but should be enough to get you started. Any questions, bug reports, please <em>feel free</em> to <a href="http://kucrut.org/contact/">contact</a> me.</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/kc-settings/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>Add Custom Attributes to WordPress&#8217; Posts Navigation</title>
		<link>http://kucrut.org/wordpress-posts-navigation-custom-attributes/</link>
		<comments>http://kucrut.org/wordpress-posts-navigation-custom-attributes/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 17:47:48 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Tips & Tutorials]]></category>
		<category><![CDATA[Hook]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=59</guid>
		<description><![CDATA[The Problem We need to add our custom class(es) to the posts navigation links to be able to add some styles. The Solution Use the available next_posts_link_attributes and previous_posts_link_attributes hooks. How? Open your theme&#8217;s function.php file and add these lines (must be inside the &#60;?php ?&#62; tag): add_filter( 'next_posts_link_attributes', 'kc_next_post_link_attr' ); add_filter( 'previous_posts_link_attributes', 'kc_prev_post_link_attr' ); [...]]]></description>
				<content:encoded><![CDATA[<h2>The Problem</h2>
<p>We need to add our custom class(es) to the posts navigation links to be able to add some styles.</p>
<h2>The Solution</h2>
<p>Use the available <code>next_posts_link_attributes</code> and <code>previous_posts_link_attributes</code> hooks.</p>
<h2>How?</h2>
<p>Open your theme&#8217;s <code>function.php</code> file and add these lines (must be inside the &lt;?php ?&gt; tag):</p>
<pre>add_filter( 'next_posts_link_attributes', 'kc_next_post_link_attr' );
add_filter( 'previous_posts_link_attributes', 'kc_prev_post_link_attr' );

function kc_next_post_link_attr() {
	return 'class="next-page"';
}

function kc_prev_post_link_attr() {
	return 'class="prev-page"';
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/wordpress-posts-navigation-custom-attributes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tempelan</title>
		<link>http://kucrut.org/tempelan/</link>
		<comments>http://kucrut.org/tempelan/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 21:55:22 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[HTML Templates]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=11</guid>
		<description><![CDATA[This is a simple CV site template for you who need a quick site to show your work/portfolio. It uses valid XHTML 1.1 Strict and easily modifiable. jScrollPane is used for the scrolling, but should degrade nicely when JavaScript is turned off. For the image popups, Fancybox did a nice job. This template has a [...]]]></description>
				<content:encoded><![CDATA[<p>This is a simple CV site template for you who need a quick site to show your work/portfolio. It uses valid XHTML 1.1 Strict and easily modifiable.<span id="more-11"></span> jScrollPane is used for the scrolling, but should degrade nicely when JavaScript is turned off. For the image popups, Fancybox did a nice job.</p>
<p>This template has a contact page, but currently doesn&#8217;t have the ability to send emails yet. I&#8217;ll try to integrate a simple PHP script when I have some free time, but in the meantime, you can of course integrate a script of your choice :)</p>
<h2>Preview</h2>
<p><a href="http://demo.surosowan.com/tempelan/"><img src="http://kucrut.org/content/uploads/2010/08/tempelan.png" alt="Tempelan Preview" title="Tempelan" width="630" height="630" class="aligncenter size-full wp-image-52" /></a></p>
<h2>Credits:</h2>
<ul>
<li><a href="http://www.smashingmagazine.com/">Smashing Magazine</a> for the icons</li>
<li><a href="http://jquery.com/">jQuery</a></li>
<li><a href="http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html">jScrollPane</a></li>
<li><a href="http://brandonaaron.net/code/mousewheel/docs">jQuery mousewheel</a></li>
<li><a href="http://fancybox.net/">Fancybox</a></li>
</ul>
<p><strong>License:</strong> <a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GPL v2</a><br />
<strong>Links:</strong> <a href="http://kucrut.github.com/Tempelan/" title="Tempelan Demo">Demo</a>, <a href="http://github.com/kucrut/Tempelan" title="Download Tempelan">Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/tempelan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello!</title>
		<link>http://kucrut.org/hello/</link>
		<comments>http://kucrut.org/hello/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 21:56:20 +0000</pubDate>
		<dc:creator>Dzikri Aziz</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://kucrut.org/?p=1</guid>
		<description><![CDATA[Setelah sekian lama&#8230;. kucrut kembali lagi mencoba untuk mengisi blog ini. Masih banyak bagian yang belum selesai dengan theme blog ini. Untuk itu jangan kaget bila penampilannya terus-menerus berubah dari waktu ke waktu :)]]></description>
				<content:encoded><![CDATA[<p>Setelah sekian lama&#8230;. kucrut kembali lagi mencoba untuk mengisi blog ini.</p>
<p>Masih banyak bagian yang belum selesai dengan theme blog ini. Untuk itu jangan kaget bila penampilannya terus-menerus berubah dari waktu ke waktu :)</p>
]]></content:encoded>
			<wfw:commentRss>http://kucrut.org/hello/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
