<?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>wpCanyon</title>
	<atom:link href="http://wpcanyon.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpcanyon.com</link>
	<description>Wordpress tutorials, articles, hacks, tricks and many more</description>
	<lastBuildDate>Thu, 10 Feb 2011 01:21:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Redirect Back To Post/Page Listing After Publish/Update</title>
		<link>http://wpcanyon.com/tipsandtricks/redirect-back-to-postpage-listing-after-publishupdate/</link>
		<comments>http://wpcanyon.com/tipsandtricks/redirect-back-to-postpage-listing-after-publishupdate/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 19:42:11 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tips&Tricks]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=860</guid>
		<description><![CDATA[In case you want to be redirected back to the post/page listing and not to the edit page of that post/page on publish/update here is a little snippet that does just that.]]></description>
			<content:encoded><![CDATA[<p>Just drop this in <strong>functions.php</strong></p>
<pre class="brush: php;">
add_action('publish_page', 'wpcanyon_redirect_on_page_publish');
function wpcanyon_redirect_on_page_publish($post_ID) {
	header('Location: '.get_home_url().'/wp-admin/edit.php?post_type=page');
	exit();
}

add_action('publish_post', 'wpcanyon_redirect_on_post_publish');
function wpcanyon_redirect_on_post_publish($post_ID) {
	header('Location: '.get_home_url().'/wp-admin/edit.php?post_type=post');
	exit();
}
</pre>
<p>That&#8217;s all, hope you find it useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tipsandtricks/redirect-back-to-postpage-listing-after-publishupdate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Solution if previous_posts_link() and next_posts_link() are not working</title>
		<link>http://wpcanyon.com/tipsandtricks/solution-previous_posts_link-and-next_posts_link-not-working/</link>
		<comments>http://wpcanyon.com/tipsandtricks/solution-previous_posts_link-and-next_posts_link-not-working/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 23:10:27 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tips&Tricks]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=854</guid>
		<description><![CDATA[Using WP_Query and pagination isn't showing up? The solution is quite simple.]]></description>
			<content:encoded><![CDATA[<p>I had a little problem on a project today, previous_posts_link() and next_posts_link() weren&#8217;t showing up.</p>
<p>The solution is simple if you are using WP_Query, just add the max_num_pages as the second parameter for next_posts_link(). Like this:</p>
<pre class="brush: php;">
next_posts_link('&amp;gt;', $custom_query-&gt;max_num_pages);
</pre>
<p>Change <strong>custom_query</strong> to whatever variable name you&#8217;re using when you&#8217;re calling <strong>new WP_Query();</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tipsandtricks/solution-previous_posts_link-and-next_posts_link-not-working/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Adding Classes to the Current Page Item in wp_nav_menu()</title>
		<link>http://wpcanyon.com/tipsandtricks/adding-classes-to-the-current-page-item-in-wp_nav_menu/</link>
		<comments>http://wpcanyon.com/tipsandtricks/adding-classes-to-the-current-page-item-in-wp_nav_menu/#comments</comments>
		<pubDate>Tue, 14 Dec 2010 16:02:40 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tips&Tricks]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=837</guid>
		<description><![CDATA[Something that was bugging me for a long time while doing HTML -> WordPress conversions, and i finally decided to dive into the source code of WordPress and find a solution. Hope it helps you too.]]></description>
			<content:encoded><![CDATA[<p>I encountered this issue many many times while doing HTML Template to WordPress theme conversions. The thing is that WordPress will add &#8220;current-page-item&#8221; class to the current page list item in the menu, but in 90% of cases it won&#8217;t be like that in the HTML Template you&#8217;re about to convert to a WordPress theme (it&#8217;s mostly &#8220;current&#8221; or &#8220;active&#8221;). So, then you need to change classes in the CSS and maybe JS if you have something targeting the current page in the menu but that&#8217;s a bit too much work.</p>
<p>So i finally decided to take a look at the code behind wp_nav_menu() and write up a simple code to make my work go a bit faster and easier from now on. So here it is:</p>
<pre class="brush: php;">
add_filter( 'nav_menu_css_class', 'additional_active_item_classes', 10, 2 );

function additional_active_item_classes($classes = array(), $menu_item = false){

	if(in_array('current-menu-item', $menu_item-&gt;classes)){
		$classes[] = 'active';
	}

	return $classes;
}
</pre>
<p><strong>Update:</strong></p>
<p>After messing around with the $menu_item array i noticed that the whole snippet can be drastically simplified. Since the $menu_item array also holds the classes the menu item will have and <em>&#8220;current-menu-item&#8221;</em> class is not something that&#8217;s gonna differ from theme to theme since it&#8217;s defined by the core, doing a simple in_array() check for <em>&#8220;current-menu-item&#8221;</em> in the classes array will do the trick. Can&#8217;t get simpler then this.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tipsandtricks/adding-classes-to-the-current-page-item-in-wp_nav_menu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Automatically Create A Page On Theme Activation</title>
		<link>http://wpcanyon.com/tipsandtricks/automatically-create-a-page-on-theme-activation/</link>
		<comments>http://wpcanyon.com/tipsandtricks/automatically-create-a-page-on-theme-activation/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 22:11:32 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tips&Tricks]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=773</guid>
		<description><![CDATA[Taking a snippet from snipplr.com and improve it quite a lot. The snippet is for automatically creating a page (can be used to create a post too) right after the theme is activated.]]></description>
			<content:encoded><![CDATA[<p>Found <a href="http://snipplr.com/view/43784/automatically-create-page-when-theme-is-activated/">this cool snippet</a> over at snipplr.com today, for automatically creating a page on theme activation, but i couldn&#8217;t not notice a few ways to improve it. Originally the snippet came from <a href="http://graphicriver.net/forums/thread/create-a-new-page-upon-theme-activation/33238?page=2">graphicriver&#8217;s forum</a>.</p>
<p><em>You can <a href="#improved-version">skip right to the improved version</a> if you want.</em></p>
<h2>Original Snippet</h2>
<p>Bellow you can see the original code with some comments added by me to help you (i guess) understand the code easier.</p>
<pre class="brush: php;">
//Get data for page with the title of the new post.
//We'll later use this to check if it already exists, if it does we won't create it.
$page_check = get_page_by_title('Sermon Media');
$page_check_id = $page_check-&gt;ID;

//Declaring the data for our new page
$new_page = array(
	'post_type' =&gt; 'page',
	'post_title' =&gt; 'Sermon Media',
	'post_status' =&gt; 'publish',
	'post_author' =&gt; 1,
);

//If the page doesn't already exist create it
if(!isset($page_check_id)){
	wp_insert_post($new_page);
	//getting the data of our new page and assigning a page template for it.
	//If you're not going to use a custom template remove the next 3 lines
	$new_page_data = get_page_by_title('Sermon Media');
	$new_page_id = $new_page_data-&gt;ID;
	update_post_meta($new_page_id, '_wp_page_template','page-template.php');
}
</pre>
<p></p>
<h2>Improving  It</h2>
<p>I found few ways to improve it, some are minor and some are very important. Let&#8217;s start&#8230;</p>
<p><strong>Unnecessary database calls</strong><br />
Ok, this is very important. As it is now, every single time a page loads the snippet will be executing get_page_by_title() function. There is absolutely no need for that, we need the whole snippet to be executed only after the theme has been activated. Luckily, that&#8217;s very easy, here is how:</p>
<pre class="brush: php;">
if (isset($_GET['activated']) &amp;&amp; is_admin()){
    //the theme has just been activated, coding goes here
}
</pre>
<p></p>
<p><strong>Title is needed 3 times</strong><br />
Important. As you can see the page title is used 3 times(lines 3, 9 and 19). There is a chance of mistyping it on one place and create a problem (even the person that added it to snipplr forgot to change it on the last line, it was still &#8220;Post Title&#8221;).</p>
<p><strong>Page template &#8211; issue 1</strong><br />
After the snippet is added there are 3 more lines, they add a page template to the newly created page. What if you don&#8217;t want to assign a specific template to the page? In my opinion it&#8217;s better to have a variable at the top which will be empty by default, and if you wish you can add the template filename there.</p>
<p><strong>Page template &#8211; issue 2</strong><br />
wp_insert_post() will return the id of the page, there is no need to use a special function to get something we already have. So simply instead of <strong>&#8220;wp_insert_post()&#8221;</strong> it&#8217;ll be <strong>&#8220;$new_page_id = wp_insert_post()&#8221;</strong> and we can remove the next 2 lines.</p>
<h2 id="improved-version">Final Snippet</h2>
<pre class="brush: php;">
if (isset($_GET['activated']) &amp;&amp; is_admin()){

	$new_page_title = 'This is the page title';
	$new_page_content = 'This is the page content';
	$new_page_template = ''; //ex. template-custom.php. Leave blank if you don't want a custom page template.

	//don't change the code bellow, unless you know what you're doing

	$page_check = get_page_by_title($new_page_title);
	$new_page = array(
		'post_type' =&gt; 'page',
		'post_title' =&gt; $new_page_title,
		'post_content' =&gt; $new_page_content,
		'post_status' =&gt; 'publish',
		'post_author' =&gt; 1,
	);
	if(!isset($page_check-&gt;ID)){
		$new_page_id = wp_insert_post($new_page);
		if(!empty($new_page_template)){
			update_post_meta($new_page_id, '_wp_page_template', $new_page_template);
		}
	}

}
</pre>
<p></p>
<h2>Final Words</h2>
<p>I&#8217;m not saying that &#8220;MattStrange&#8221;, the original author, wrote a bad code. We all write something that can be improved, hell i don&#8217;t even want to take a look at the wpCanyon&#8217;s current theme source code, it was made long time ago and i&#8217;ll simply start working on a new theme these days, instead of rewriting 90% of the current one.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tipsandtricks/automatically-create-a-page-on-theme-activation/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Why Don&#8217;t You Let People See The Options Panel Demo</title>
		<link>http://wpcanyon.com/articles/why-dont-you-let-people-see-the-options-panel-demo/</link>
		<comments>http://wpcanyon.com/articles/why-dont-you-let-people-see-the-options-panel-demo/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 18:27:15 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Articles]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=733</guid>
		<description><![CDATA[Noticed how not a single premium WordPress themes seller allow you to give the options panel a try and see the full potential of a theme. Well here is a little idea that might change that.]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpcanyon.com/wp-content/uploads/2010/07/optionspanelpic1.png" alt="" title="optionspanelpic" width="600" height="100" class="alignnone size-full wp-image-741" /></p>
<p>One very important aspect of a premium WordPress theme is the flexibility it offers to the users. That flexibility comes from the theme&#8217;s options panel. Some themes have ten options and some even have hundreds. But why doesn&#8217;t anyone allow the potential buyers to try the options out, make changes and see the full demonstration of a theme they are about to buy, not even WooThemes does that.</p>
<h2>Why?</h2>
<p>Well it&#8217;s quite simple, every time someone makes a change it will overwrite someone else&#8217;s changes and there is a big possibility that more people will be testing the options out at the same time and keep overwriting each other&#8217;s changes and wouldn&#8217;t be able to see how it works and behaves properly thus confusing everybody.</p>
<p>You probably have a blog, do you? Well imagine few more people making changes to it at the same time as you do, it&#8217;s like that. Stuff changes and you have no idea why, you didn&#8217;t change it. </p>
<h2>So, How?</h2>
<p>Well the idea is pretty simple, if you&#8217;re a theme/plugin developer you know that we have to add a prefix to our field names that go inside the database in order to avoid conflicts with other themes/plugins that could use the same names. For example, an option where the user inputs text he wants to be shown in the footer of a theme, we can call it &#8220;footer_text&#8221; but then it might conflict, so we add a prefix like &#8220;wpcp_&#8221;, &#8220;aviatic_&#8221; or anything else that we think should be unique or at least unlikely to be used by something else, so we get wpcp_footer_text. </p>
<p>Using that same method we can add the username of the user that makes changes as a suffix or prefix (doesn&#8217;t matter) so if a user with username &#8220;John&#8221; makes changes they will be saved and later retrieved as &#8220;wpcp_footer_text_John&#8221; and when a different user with username &#8220;Michael&#8221; makes changes it will be &#8220;wpcp_footer_text_Michael&#8221; so no conflicts will be made and no data will be overwritten.</p>
<h2>Database Usage</h2>
<p>For themes that have a big amount of options (like WooThemes or PliablePress) it will use a lot of data. For example 50 options changed by 100 users is 5000 rows in the database. But that&#8217;s not a big problem because WordPress can be set to delete the data after a certain time period.</p>
<h2>Does It Really Work?</h2>
<p>Well in theory it should work just fine, it&#8217;s pretty simple, i haven&#8217;t tested it yet but i started working on a little example and will update this post when it&#8217;s done. In the meantime if anybody is reading this let me know your thoughts.</p>
<h2>Update: It Works</h2>
<p>I just tested it and it works without a problem. I needed 2 minutes to alter a theme to support this, yes just 2 minutes, few lines of code. Check back later, i&#8217;ll throw in a demo so you can all test it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/articles/why-dont-you-let-people-see-the-options-panel-demo/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Increasing The Categories Selection Height In WordPress Admin</title>
		<link>http://wpcanyon.com/tipsandtricks/increasing-the-categories-selection-height-in-wordpress-admin/</link>
		<comments>http://wpcanyon.com/tipsandtricks/increasing-the-categories-selection-height-in-wordpress-admin/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 10:46:51 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tips&Tricks]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=727</guid>
		<description><![CDATA[Increasing the height of the categories selection listing in WordPress admin using 2 different methods, CSS and jQuery. ]]></description>
			<content:encoded><![CDATA[<p>Few days ago a loyal reader (thx Sullivan) asked how to increase the height of the categories listing in WordPress admin since he has a lot of categories. If you wonder what categories listing it&#8217;s the one on the &#8220;add new post&#8221; page where you select which categories will the post be in (it&#8217;s also located on other places). </p>
<h2>CSS hack</h2>
<p>This hack is a simple CSS hack that allows you to change the height of the default 200px to a new fixed height.</p>
<pre class="brush: php;">
add_action('admin_head', 'categories_list_height_css');

function categories_list_height_css() {
	echo'
	&lt;style type=&quot;text/css&quot;&gt;
		#category-all.tabs-panel{ height:500px; }
	&lt;/style&gt;
	';
}
</pre>
<h2>jQuery hack</h2>
<p>This is a bit better hack because it will change the height dynamically to fit all the categories.</p>
<pre class="brush: php;">
add_action('admin_head', 'categories_list_height_jquery');

function categories_list_height_jquery() {
	echo'
	&lt;script type=&quot;text/javascript&quot;&gt;
		jQuery(function($){
			$(&quot;#category-all.tabs-panel&quot;).height($(&quot;#categorychecklist&quot;).height());
		});
	&lt;/script&gt;
	';
}
</pre>
<p>Both hacks go inside <strong>functions.php</strong> file inside your theme folder.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tipsandtricks/increasing-the-categories-selection-height-in-wordpress-admin/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Show Top Commentators In WordPress Without A Plugin</title>
		<link>http://wpcanyon.com/tipsandtricks/show-top-commentators-in-wordpress-without-a-plugin/</link>
		<comments>http://wpcanyon.com/tipsandtricks/show-top-commentators-in-wordpress-without-a-plugin/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 14:36:56 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tips&Tricks]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=716</guid>
		<description><![CDATA[Here is a simple code snippet for getting the top commentators listing in WordPress so you don't have to use a plugin for that purpose.]]></description>
			<content:encoded><![CDATA[<p>First put this snippet in your functions.php file inside your theme.</p>
<pre class="brush: php;">
function top_comment_authors($amount = 5){

	global $wpdb;

	$results = $wpdb-&gt;get_results('
		SELECT
			COUNT(comment_author_email) AS comments_count, comment_author_email, comment_author, comment_author_url
		FROM
			'.$wpdb-&gt;comments.'
		WHERE
			comment_author_email != &quot;&quot; AND comment_type = &quot;&quot; AND comment_approved = 1
		GROUP BY
			comment_author_email
		ORDER BY
			comments_count DESC, comment_author ASC
		LIMIT '.$amount

	);

	$output = &quot;&lt;ul&gt;&quot;;
	foreach($results as $result){
		$output .= &quot;&lt;li&gt;&quot;.$result-&gt;comment_author.&quot;&lt;/li&gt;&quot;;
	}
	$output .= &quot;&lt;/ul&gt;&quot;;

	echo $output;

}
</pre>
<p>Now you can call it anywhere in your theme using the <strong>top_comment_authors()</strong> function. By default it will show top 5 but if you want a different amount simply call it like <strong>top_comment_authors(7)</strong> which will show top 7 comment authors.</p>
<p>If you want to show more data in the listing you can use these:</p>
<ul>
<li><strong>$result->comment_author_email</strong> <em>the email address of the commentator</em></li>
<li><strong>$result->comments_count</strong> <em>comments number of the commentator</em></li>
<li><strong>$result->comment_author_url</strong> <em>the website address of the commentator</em></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tipsandtricks/show-top-commentators-in-wordpress-without-a-plugin/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Adding Classes To previous_posts_link() And next_posts_link() In WordPress</title>
		<link>http://wpcanyon.com/tipsandtricks/adding-attributes-to-previous-and-next-post-links/</link>
		<comments>http://wpcanyon.com/tipsandtricks/adding-attributes-to-previous-and-next-post-links/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 10:04:29 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tips&Tricks]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=690</guid>
		<description><![CDATA[Little snippet for adding classes and other attributes to previous_post_link() and next_post_link().]]></description>
			<content:encoded><![CDATA[<p>Simply insert the snippet bellow inside your theme&#8217;s function.php file.</p>
<pre class="brush: php;">
add_filter('next_posts_link_attributes', 'posts_link_attributes');
add_filter('previous_posts_link_attributes', 'posts_link_attributes');

function posts_link_attributes(){
	return 'class=&quot;styled-button&quot;';
}
</pre>
<p>What actually this snippet does is adding the html you return in the function to the anchor. </p>
<p>&lt;a href=&#8217;link&#8217; <strong>HERE</strong>&gt;</p>
<p>So you can add ID, classes and other attributes an anchor can have. By default it will only have the <strong>href</strong> attribute.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tipsandtricks/adding-attributes-to-previous-and-next-post-links/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Best On WordPress From The Past Week N.10</title>
		<link>http://wpcanyon.com/roundups/best-on-wordpress-from-the-past-week-n-10/</link>
		<comments>http://wpcanyon.com/roundups/best-on-wordpress-from-the-past-week-n-10/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 08:52:21 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Roundups]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=682</guid>
		<description><![CDATA[This is our weekly roundup of the best wordpress articles, tips, tricks and news from the past week we ware able to find on the web.]]></description>
			<content:encoded><![CDATA[<p>All of these were tweeted on our twitter account during the past week, so don&#8217;t forget to <a href='http://wpcanyon.com' target='_blank'>follow wpCanyon on twitter</a> for awesome wordpress related links.</p>
<h2><a href='http://www.yourinspirationweb.com/en/how-to-install-wordpress-locally/' target='_blank'>How to install WordPress Locally?</a></h2>
<p><a href='http://www.yourinspirationweb.com/en/how-to-install-wordpress-locally/' target='_blank'><img src='http://wpcanyon.com/post-images/topweek10/top1.png' alt='top' /></a></p>
<h2><a href='http://wpcanyon.com/tipsandtricks/adding-a-custom-field-automatically-on-postpage-publish/' target='_blank'>Adding A Custom Field Automatically On Post/Page Publish</a></h2>
<p><a href='http://wpcanyon.com/tipsandtricks/adding-a-custom-field-automatically-on-postpage-publish/' target='_blank'><img src='http://wpcanyon.com/post-images/topweek10/top2.png' alt='top' /></a></p>
<h2><a href='http://bavotasan.com/downloads/magazine-basic-free-wordpress-theme/' target='_blank'>Free Theme: Magazine Basic v2.6.1</a></h2>
<p><a href='http://bavotasan.com/downloads/magazine-basic-free-wordpress-theme/' target='_blank'><img src='http://wpcanyon.com/post-images/topweek10/top3.png' alt='top' /></a></p>
<h2><a href='http://wpengineer.com/flattr-button-4-wordpress-without-a-plugin/' target='_blank'>Flattr Button for WordPress without a Plugin</a></h2>
<p><a href='http://wpengineer.com/flattr-button-4-wordpress-without-a-plugin/' target='_blank'><img src='http://wpcanyon.com/post-images/topweek10/top4.png' alt='top' /></a></p>
<h2><a href='http://carsonified.com/blog/dev/20-must-have-wordpress-plugins-for-every-website/' target='_blank'>20 Must Have WordPress Plugins For Every Website</a></h2>
<p><a href='http://carsonified.com/blog/dev/20-must-have-wordpress-plugins-for-every-website/' target='_blank'><img src='http://wpcanyon.com/post-images/topweek10/top5.png' alt='top' /></a></p>
<h2><a href='http://justintadlock.com/archives/2010/06/10/a-refresher-on-custom-taxonomies' target='_blank'>A Refresher On Custom Taxonomies</a></h2>
<p><a href='http://justintadlock.com/archives/2010/06/10/a-refresher-on-custom-taxonomies' target='_blank'><img src='http://wpcanyon.com/post-images/topweek10/top6.png' alt='top' /></a></p>
<h2><a href='http://themethesis.com/resources/gravity-forms/' target='_blank'>5 Reasong Gravity Forms Makes Your From Plugin Look Like Crap</a></h2>
<p><a href='http://themethesis.com/resources/gravity-forms/' target='_blank'><img src='http://wpcanyon.com/post-images/topweek10/top7.png' alt='top' /></a></p>
<h2><a href='http://www.webdesignerdepot.com/2010/06/wordpress-from-kubrick-to-twenty-ten/' target='_blank'>WordPress: From Kubrick to Twenty Ten</a></h2>
<p><a href='http://www.webdesignerdepot.com/2010/06/wordpress-from-kubrick-to-twenty-ten/' target='_blank'><img src='http://wpcanyon.com/post-images/topweek10/top8.png' alt='top' /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/roundups/best-on-wordpress-from-the-past-week-n-10/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Adding A Custom Field Automatically On Post/Page Publish</title>
		<link>http://wpcanyon.com/tipsandtricks/adding-a-custom-field-automatically-on-postpage-publish/</link>
		<comments>http://wpcanyon.com/tipsandtricks/adding-a-custom-field-automatically-on-postpage-publish/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 10:28:27 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tips&Tricks]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=670</guid>
		<description><![CDATA[Little code snippet for automatically adding a custom field  for a page or post when they are published.]]></description>
			<content:encoded><![CDATA[<p>Simply add the code bellow in your <strong>functions.php</strong> file inside your theme&#8217;s folder. And don&#8217;t forget to change the custom field name.</p>
<pre class="brush: php;">
add_action('publish_page', 'add_custom_field_automatically');
add_action('publish_post', 'add_custom_field_automatically');
function add_custom_field_automatically($post_ID) {
	global $wpdb;
	if(!wp_is_post_revision($post_ID)) {
		add_post_meta($post_ID, 'field-name', 'custom value', true);
	}
}
</pre>
<p>That&#8217;s it. Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tipsandtricks/adding-a-custom-field-automatically-on-postpage-publish/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

