<?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 &#187; Tutorials</title>
	<atom:link href="http://wpcanyon.com/category/tutorials/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>Creating a Contact Page From Scratch in WordPress</title>
		<link>http://wpcanyon.com/tutorials/creating-a-contact-page-from-scratch-in-wordpress/</link>
		<comments>http://wpcanyon.com/tutorials/creating-a-contact-page-from-scratch-in-wordpress/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 11:11:48 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=561</guid>
		<description><![CDATA[Step by step guide on building a contact page in WordPress using custom templates.]]></description>
			<content:encoded><![CDATA[<p>Well as the title says we are going to build a contact page in this tutorial. Nothing fancy, just the main stuff like:</p>
<ul>
<li>PHP validation</li>
<li>jQuery validation</li>
<li>AJAX submission (if javascript is turned off it will be submitted normally)</li>
</ul>
<p>We&#8217;re going to use WordPress custom template for this. Ready to get started? Just so you know, if you encounter any problems following this steps feel free to ask me about resolving them using the comment form and i&#8217;ll do my best to help you out.</p>
<h2>Step 1 &#8211; Creating the template</h2>
<p>First of all we need to create a custom template for our contact page. Simply create a new file in the theme folder, name it <strong>template-contact.php</strong> and add the code bellow.</p>
<pre class="brush: php;">
&lt;?php
/*
Template Name: Contact Form
*/
?&gt;
</pre>
<p>Now open up <strong>page.php</strong> file from your theme and copy the whole content after the code we just added. You should end up with something similar to the code bellow.</p>
<pre class="brush: php;">
&lt;?php
/*
Template Name: Contact Form
*/
?&gt;

&lt;?php get_header(); ?&gt;

	&lt;div id=&quot;main&quot;&gt;

		&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;

			&lt;div class=&quot;post&quot; id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;

				&lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;

				&lt;div class=&quot;entry&quot;&gt;

					&lt;?php the_content(); ?&gt;

				&lt;/div&gt;

			&lt;/div&gt;

		&lt;?php endwhile; endif; ?&gt;

	&lt;/div&gt;

&lt;?php get_sidebar(); ?&gt;

&lt;?php get_footer(); ?&gt;
</pre>
<p>If you have more content then that don&#8217;t worry, it depends on the theme you&#8217;re currently using. If you are familiar with coding a WordPress theme then you can remove the comments part, but it&#8217;s not really necessary because you can disable commenting from inside the admin panel. </p>
<p>Now, if you take a look at the code bellow you will see where the rest of the code will go (the commented green colored parts)</p>
<pre class="brush: php; html-script: true;">
&lt;?php
/*
Template Name: Contact Form
*/
?&gt;

&lt;!-- PHP PART 1 GOES HERE (PROCESSING) --&gt;

&lt;?php get_header(); ?&gt;

&lt;!-- jQuery GOES HERE (VALIDATION AND AJAX PROCESSING) --&gt;

	&lt;div id=&quot;main&quot;&gt;

		&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;

			&lt;div class=&quot;post&quot; id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;

				&lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;

				&lt;div class=&quot;entry&quot;&gt;

					&lt;?php the_content(); ?&gt;

				&lt;/div&gt;

			&lt;/div&gt;

		&lt;?php endwhile; endif; ?&gt;

		&lt;!-- CONTACT FORM HTML AND PHP PART 2 (MESSAGES) GOES HERE --&gt;

	&lt;/div&gt;

&lt;?php get_sidebar(); ?&gt;

&lt;?php get_footer(); ?&gt;
</pre>
<h2>Step 2 &#8211; HTML</h2>
<p>In this step we will create the form, just copy the snippet bellow in the place for the HTML part (as shown in the part 1).</p>
<pre class="brush: xml;">
&lt;div id=&quot;contact-form&quot;&gt;
	&lt;form action=&quot;&lt;?php the_permalink(); ?&gt;&quot; id=&quot;contact-form&quot; method=&quot;post&quot;&gt;

		&lt;p&gt;&lt;label for=&quot;c_name&quot;&gt;&lt;?php _e('Name') ?&gt;&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;c_name&quot; id=&quot;c_name&quot; /&gt;&lt;/p&gt;

		&lt;p&gt;&lt;label for=&quot;c_email&quot;&gt;&lt;?php _e('Email') ?&gt;&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;c_email&quot; id=&quot;c_email&quot; /&gt;&lt;/p&gt;

		&lt;p&gt;&lt;label for=&quot;c_subject&quot;&gt;&lt;?php _e('Subject') ?&gt;&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;c_subject&quot; id=&quot;c_subject&quot; /&gt;&lt;/p&gt;

		&lt;p&gt;&lt;label for=&quot;c_message&quot;&gt;&lt;?php _e('Message') ?&gt;&lt;/label&gt; &lt;textarea name=&quot;c_message&quot; id=&quot;c_message&quot;&gt;&lt;/textarea&gt;&lt;/p&gt;

		&lt;p&gt;&lt;label for=&quot;c_submit&quot;&gt;&amp;nbsp;&lt;/label&gt; &lt;input type=&quot;submit&quot; name=&quot;c_submit&quot; id=&quot;c_submit&quot; /&gt;&lt;/p&gt;

		&lt;input type=&quot;hidden&quot; name=&quot;c_submitted&quot; id=&quot;c_submitted&quot; value=&quot;true&quot; /&gt;

	&lt;/form&gt;
&lt;/div&gt;
</pre>
<p>If you&#8217;re confused about where exactly to put it, then simply place it after the &#8220;loop&#8221; (&lt;?php endwhile; endif; ?&gt;), it&#8217;s important that it is in the same div as the div with class <em>&#8220;post&#8221;</em>. </p>
<h2>Step 3 &#8211; CSS</h2>
<p>We made the form, but it&#8217;s not really good looking so let&#8217;s add some simple styling. I commented some of the lines so it should be easy to understand what&#8217;s what. </p>
<p><em>Notice: The CSS goes in the style.css file, not inside the new template we created.</em></p>
<pre class="brush: css;">
#contact-form  label {
	display:block; /* needed in order to set a width */
	float:left; /* make it inline with the input field */
	width:100px;
}
#contact-form textarea {
	width:300px;
	height:80px;
}
#contact-form .error {
	margin-left:100px; /* same as label width */
	color: #9e2828;
}
</pre>
<p>Now it looks better, let&#8217;s move on.</p>
<h2>Step 4 &#8211; PHP</h2>
<p>The first chunk of code goes before the <em>&#8220;&lt;?php get_header(); ?&gt;&#8221;</em>.</p>
<pre class="brush: php;">
&lt;?php

$name_error = '';
$email_error = '';
$subject_error = '';
$message_error = '';

if($_REQUEST['c_submitted']){

	//check name
	if(trim($_REQUEST['c_name'] == &quot;&quot;)){
		//it's empty
		$name_error = __('You forgot to fill in your name');
		$error = true;
	}else{
		//its ok
		$c_name = trim($_REQUEST['c_name']);
	}

	//check email
	if(trim($_REQUEST['c_email'] === &quot;&quot;)){
		//it's empty
		$email_error = __('Your forgot to fill in your email address');
		$error = true;
	}else if(!eregi(&quot;^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$&quot;, trim($_REQUEST['c_email']))){
		//it's wrong format
		$email_error = __('Wrong email format');
		$error = true;
	}else{
		//it's ok
		$c_email = trim($_REQUEST['c_email']);
	}

	//check name
	if(trim($_REQUEST['c_subject'] === &quot;&quot;)){
		//it's empty
		$subject_error = __('You forgot to fill in the subject');
		$error = true;
	}else{
		//it's ok
		$c_subject = trim($_REQUEST['c_subject']);
	}

	//check name
	if(trim($_REQUEST['c_message'] === &quot;&quot;)){
		//it's empty
		$message_error = __('You forgot to fill in your name');
		$error = true;
	}else{
		//it's ok
		$c_message = trim($_REQUEST['c_message']);
	}

	//if no errors occured
	if($error != true) {

		$email_to = &quot;your_email_here@gmail.com&quot;; //change this with your email address
		$message_body = &quot;Name: $c_name \n\nEmail: $c_email \n\nComments: $c_message&quot;;
		$headers = &quot;From&quot;.get_bloginfo('title').' &lt;'.$emailTo.'&gt;' . &quot;\r\n&quot; .'Reply-To' . $email;

		mail($email_to, $c_subject, $message_body, $headers);

		$email_sent = true;
	}

}

?&gt;
</pre>
<p>It&#8217;s a big chunk of code but it&#8217;s really simple, first we validate the submitted data by checking if it&#8217;s empty and is the email correct. If it is empty or the email isn&#8217;t in the right format we set the <strong>&#8220;error&#8221;</strong> variable to true and the error messages so after finishing with the validation we can know what to do and let the user know too, submit or not. If the error variable is not set to true then we process with the emailing and if everything goes well we set up another variable, <strong>email_sent</strong>, to true so we know that the email is sent.</p>
<p><strong>Don&#8217;t forget to change the $email_to variable to your email address.</strong></p>
<p>In the second part of the PHP we are going to show the user if everything is correct, and if it&#8217;s not let him know what&#8217;s wrong. The new codes are mixing up with the previous coding so let&#8217;s take it slowly.</p>
<p>First of all when the contact email is successfully sent we don&#8217;t want to show the contact form, right? </p>
<pre class="brush: php;">
&lt;?php if(isset($email_sent) &amp;&amp; $email_sent == true){ ?&gt;

	&lt;p class=&quot;email-sent&quot;&gt;&lt;?php _e('Thank you for contacting. I will answer your email as soon as possible.') ?&gt;&lt;/p&gt;

&lt;?php }else{ ?&gt;

	&lt;div id=&quot;contact-form&quot;&gt;
		&lt;!-- the contact form --&gt;
	&lt;/div&gt;

&lt;?php } ?&gt;
</pre>
<p>Using a simple if/else check we are either gonna show the message for the successful contact or the contact form. The part inside the <strong>}else{</strong> and <strong>}</strong> is the contact form HTML, nothing new.</p>
<p>Now, it&#8217;s time for adding the code that show the error messages if something isn&#8217;t filled in right. After every paragraph (&lt;p&gt;content&lt;/p&gt;) we will check if the error variables are not empty and if they aren&#8217;t then echo that error. This is how it looks after all the fields are updated.</p>
<pre class="brush: php;">
&lt;p&gt;&lt;label for=&quot;c_name&quot;&gt;&lt;?php _e('Name') ?&gt;&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;c_name&quot; id=&quot;c_name&quot; /&gt;&lt;/p&gt;
&lt;?php if($name_error != '') { ?&gt;
	&lt;p class=&quot;error&quot;&gt;&lt;?php echo $name_error;?&gt;&lt;/p&gt;
&lt;?php } ?&gt;

&lt;p&gt;&lt;label for=&quot;c_email&quot;&gt;&lt;?php _e('Email') ?&gt;&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;c_email&quot; id=&quot;c_email&quot; /&gt;&lt;/p&gt;
&lt;?php if($email_error != '') { ?&gt;
	&lt;p class=&quot;error&quot;&gt;&lt;?php echo $email_error;?&gt;&lt;/p&gt;
&lt;?php } ?&gt;

&lt;p&gt;&lt;label for=&quot;c_subject&quot;&gt;&lt;?php _e('Subject') ?&gt;&lt;/label&gt; &lt;input type=&quot;text&quot; name=&quot;c_subject&quot; id=&quot;c_subject&quot; /&gt;&lt;/p&gt;
&lt;?php if($subject_error != '') { ?&gt;
	&lt;p class=&quot;error&quot;&gt;&lt;?php echo $subject_error;?&gt;&lt;/p&gt;
&lt;?php } ?&gt;

&lt;p&gt;&lt;label for=&quot;c_message&quot;&gt;&lt;?php _e('Message') ?&gt;&lt;/label&gt; &lt;textarea name=&quot;c_message&quot; id=&quot;c_message&quot;&gt;&lt;/textarea&gt;&lt;/p&gt;
&lt;?php if($message_error != '') { ?&gt;
	&lt;p class=&quot;error&quot;&gt;&lt;?php echo $message_error;?&gt;&lt;/p&gt;
&lt;?php } ?&gt;

&lt;p&gt;&lt;label for=&quot;c_submit&quot;&gt;&amp;nbsp;&lt;/label&gt; &lt;input type=&quot;submit&quot; name=&quot;c_submit&quot; id=&quot;c_submit&quot; /&gt;&lt;/p&gt;
</pre>
<p>That&#8217;s it. Hope i was clear enough about this part, let me know if you have any questions.</p>
<h2>Step 5 &#8211; Validation and ajax submissions with jQuery </h2>
<p>I made some comments inside the code to explain what&#8217;s what but if you don&#8217;t understand something feel free to ask.</p>
<pre class="brush: jscript;">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--//--&gt;&lt;![CDATA[//&gt;&lt;!--

	jQuery(document).ready(function(){

		jQuery('#contact-form form').submit(function(e){

			//prevent the normal processing
			e.preventDefault();

			//delete the errors (so we don't get duplicates ')
			jQuery(&quot;#contact-form .error&quot;).remove();

			//declaring and setting vars
			var value, theID, empty_error, email_error, error, emailReg;
			empty_error = '&lt;p class=&quot;error&quot;&gt;This field is required&lt;/p&gt;';
			email_error = '&lt;p class=&quot;error&quot;&gt;The email you entered is not valid&lt;/p&gt;';
			error = false;
			emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;				

			//validating
			jQuery('#contact-form textarea, #contact-form input[type=text]').each(function(){
				value = jQuery(this).val();
				theID = jQuery(this).attr('id');
				if(value == ''){
					jQuery(this).parent().append('&lt;p class=&quot;error&quot;&gt;'+empty_error+'&lt;/p&gt;');
					error = true;
				}
				if(theID == 'c_email' &amp;&amp; value != '' &amp;&amp; !emailReg.test(value)){
					jQuery(this).parent().append('&lt;p class=&quot;error&quot;&gt;'+email_error+'&lt;/p&gt;');
					error = true;
				}
			});

			//send email and loaded message
			if(error == false){
				jQuery('#contact-form').load('&lt;?php the_permalink(); ?&gt; .email-sent', jQuery('#contact-form form').serialize());
			}

		});

	});

//--&gt;!]]&gt;
&lt;/script&gt;
</pre>
<h2>Step 6 &#8211; Adding the page</h2>
<p>Now when everything is coded let&#8217;s create the page, follow these steps:</p>
<ul>
<li>Go to the create new page in the admin panel</li>
<li>On the right side, bellow the &#8220;publish&#8221; widget you should see &#8220;attributes&#8221; widget, in the template dropdown/selectbox choose &#8220;Contact Form&#8221;</li>
<li>If you want to show some content before the contact form simply add it like when you add content for any other page/post.</li>
<li>Hit publish and that&#8217;s it.</li>
</ul>
<h2>Notice</h2>
<p>Have in mind that if you are building a plugin or theme for wide use then you should read more about <a href='http://codex.wordpress.org/Writing_a_Plugin#Internationalizing_Your_Plugin' target='_blank'>internationalizing plugins and themes</a>.  That way it can be translated easily to more languages.</p>
<h2>Final Words</h2>
<p>We&#8217;re done. If you would also like this contact page to have javascript/jQuery validation and ajax processing then say so in the comments and i&#8217;ll update this tutorial.</p>
<p>Hope it was easy to follow this tutorial and if you liked it then <a href='http://twitter.com/wpcanyon' target='_blank'>follow wpCanyon on twitter</a> or <a href='http://feeds.feedburner.com/wpcanyon' target='_blank'>subscribe to the RSS feed</a>, you don&#8217;t want to miss out on more cool tuts like this one, don&#8217;t you?</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tutorials/creating-a-contact-page-from-scratch-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>9 Effective Ways To Encourage Comments On Your Blog</title>
		<link>http://wpcanyon.com/tutorials/9-effective-ways-to-encourage-comments-on-your-blog/</link>
		<comments>http://wpcanyon.com/tutorials/9-effective-ways-to-encourage-comments-on-your-blog/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 09:38:51 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=290</guid>
		<description><![CDATA[Bloggers love comments, so what can a blogger do to encourage his visitors to comment? Here are 9 effective ways to do that. ]]></description>
			<content:encoded><![CDATA[<h2>Comments subscription</h2>
<p><img src='http://wpcanyon.com/post-images/10wayscomments/subscribe.png' /></p>
<p>Comment subscription is a great thing for those readers that are interested in the comments on a specific post. What it does basically is letting the subscriber know when a new comment has been published. If he subscribed to it there is a big chance that he is interested in a discussion and will probably leave a comment.</p>
<ul>
<li><a target="_blank" href='http://txfx.net/wordpress-plugins/subscribe-to-comments/' target='_blank'>Subscribe to comments plugin</a></li>
</ul>
<h2>DoFollow links in comments</h2>
<blockquote><p>DoFollow is simply an internet slang term given to web pages or sites that are not utilizing NoFollow. NoFollow is a hyperlink inclusion that tells search engines not to pass on any credibility or influence to an outbound link.<br />
<em><a target="_blank" href='http://www.squidoo.com/dofollow'>squidoo.com</a></em></p></blockquote>
<p>Since WordPress is automatically adding <em>rel=&#8221;nofollow&#8221;</em> to links inside comments you will need to use a plugin or a &#8220;hack&#8221; to remove it. Bellow you can find some links to articles, plugins and hacks to achieve this.</p>
<ul>
<li><a target="_blank" href='http://andybeard.eu/434/ultimate-list-of-dofollow-plugins-banish-nofollow-from-comments-and-trackbacks.html'>Ultimate List of DoFollow &#038; Nofollow Plugins – Banish Nofollow From Comments and Trackbacks</a></li>
<li><a target="_blank" href='http://www.catswhocode.com/blog/how-to-get-rid-of-the-nofollow-attribute-on-your-wordpress-blog'>http://www.catswhocode.com/blog/how-to-get-rid-of-the-nofollow-attribute-on-your-wordpress-blog (core change, not recommended)</a></li>
<li><a target="_blank" href='http://www.squidoo.com/dofollow'>DoFollow: Increase Your Backlinks with DoFollow Sites</a></li>
</ul>
<h2>Implement CommentLUV</h2>
<p><img src='http://wpcanyon.com/post-images/10wayscomments/commentluv.png' /><br />
<em>Screenshot taken from <a target="_blank" href='http://www.1stwebdesigner.com'>1stWebDesigner.com</a></em></p>
<p>CommentLUV is a great way to give something back to commentators that have a blog and encourage them to comment. What it actually does is <strong>show the comment author&#8217;s latest blog post</strong> in his comment.</p>
<ul>
<li><a target="_blank" href='http://comluv.com/'>CommentLUV website</a></li>
<li><a target="_blank" href='http://wordpress.org/extend/plugins/commentluv/'>CommentLUV plugin</a></li>
<li><a target="_blank" href='http://dofollow.info/blog/get-the-most-out-of-your-comment-luv-links/'>Get the most out of your comment luv links</a></li>
</ul>
<h2>Show a link to their twitter account</h2>
<p>This is quite rare but very nice way to encourage commenting. If the comment author has a twitter account he can leave the username when commenting and a link to his twitter account will be shown in the comment.</p>
<ul>
<li><a target="_blank" href='http://comluv.com/download/twitterlink-comments/'>TwitterLink Plugin</a></li>
</ul>
<h2>Showing top comment authors</h2>
<p>Showing top comment authors (the ones that posted most comments) and a link to their website in the sidebar (or somewhere else you might think it&#8217;s better) is a great way to encourage your visitors to comment. </p>
<p>Keeping those links as &#8220;doFollow&#8221; will be even more encouraging but it&#8217;s not a must.</p>
<ul>
<li><a target="_blank" href='http://wordpress.org/extend/plugins/top-commentators-widget/'>Top Commentators Plugin</a></li>
</ul>
<h2>Allow threaded comments</h2>
<p><img src='http://wpcanyon.com/post-images/10wayscomments/threaded.png' /><br />
<em>Above screenshot taken from <a target="_blank" href='http://css-tricks.com'>CSS-Tricks</a>.</em></p>
<p>Great way to engage users in a conversation is by using threaded comments. This allows your visitors to reply to some comment and that reply will be shown directly bellow that specific comment. Before this was possible we have been using &#8220;@&#8221; to refer to a specific commenter, which wasn&#8217;t that useful because all the comments are shown chronologically.  </p>
<h2>The comment form</h2>
<p>Between a visitor and his comment is a comment form, and it&#8217;s very well known that unattractive and messy forms can discourage form completion (in this case the comment form).  </p>
<p>Another thing that can turn your visitors away from commenting is CAPTCHA. I know there are a lot of spam comments, but akismet is a godsent plugin that stands between spam and you. Yes, once in a while a spam comment will get past it but it&#8217;s better to send a comment to spam once in a while then suffer decrease in real comments due to captcha.  </p>
<ul>
<li><a target="_blank" href='http://net.tutsplus.com/tutorials/html-css-techniques/design-a-prettier-web-form-with-css-3/'>Design a Prettier Web Form with CSS 3 (Tutorial)</a></li>
<li><a target="_blank" href='http://www.1stwebdesigner.com/inspiration/77-inspiring-blog-comment-form-designs-good-examples/'>77 Inspiring Blog Comment Form Designs (Roundup)</a></li>
<li><a target="_blank" href='http://www.blogdesignblog.com/blog-design/37-ways-to-design-the-comments-form/'>37 Ways to Design the Comments Form (Roundup)</a></li>
<li><a target="_blank" href='http://www.smileycat.com/design_elements/blog_comment_forms/'>65+ Comment Form Designs (Showcase)</a></li>
</ul>
<h2>Engage in conversation</h2>
<p>Another great way to encourage conversation is to be a part of it. Reply to the comments with your own opinion, not to every single comment but to the ones that you think that you can say something worthy.</p>
<h2>The logical</h2>
<p>There are some logical ways to encourage your visitors to comment and i don&#8217;t want to place them all as separate ways because i hate when i am reading for example an article about ways for increasing traffic and see that most of them are simply logical and everybody knows it (example <em>&#8220;content is king&#8221;</em>).</p>
<ul>
<li>Write about interesting and popular subjects</li>
<li>Ask your visitors a question related to the subject</li>
<li>Offer some kind  of a reward to the most interesting comments</li>
<li>Don&#8217;t require your visitors to be registered to comment</li>
<li>Highlight interesting comments</li>
</ul>
<h2>Final words</h2>
<p>Hope you found this article useful and if you know some more cool ways say so in the comments and i&#8217;ll be happy to update this article and of course mention you with a link to your website.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tutorials/9-effective-ways-to-encourage-comments-on-your-blog/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Separating Trackbacks And PingBacks From Comments In WordPress</title>
		<link>http://wpcanyon.com/tutorials/separating-trackbacks-and-pingbacks-from-comments-in-wordpress/</link>
		<comments>http://wpcanyon.com/tutorials/separating-trackbacks-and-pingbacks-from-comments-in-wordpress/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 22:57:12 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[pingbacks]]></category>
		<category><![CDATA[trackbacks]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=136</guid>
		<description><![CDATA[Having trackbacks, pingbacks and comments all mixed up in one place can get really messy and confusing. In this tutorial we will separate trackbacks and pingbacks from comments.]]></description>
			<content:encoded><![CDATA[<p>Last week i wrote an article about <a href='http://wpcanyon.com/tipsandtricks/disable-trackbacks-and-pingbacks-in-wordpress-comments/' target='_blank'>disabling trackbacks and pingbacks in wordpress comments</a>, but today instead of disabling them we will separate them from comments. To see how it looks you can check some of my articles here on wpCanyon.</p>
<pre class="brush: php;">
&lt;?php if ($comments) : ?&gt;

	&lt;ol&gt;

	&lt;?php foreach ($comments as $comment) : ?&gt;

		&lt;li id=&quot;comment-&lt;?php comment_ID() ?&gt;&quot; class='commentItem'&gt;
			&lt;!-- THE COMMENT LAYOUT --&gt;
		&lt;/li&gt;

	&lt;?php endforeach; /* end for each comment */ ?&gt;

	&lt;/ol&gt;

&lt;?php endif; ?&gt;
</pre>
<p>Above we can see a stripped version of an ordinary comment loop which will show comments, trackbacks and pingbacks all in one place. Let&#8217;s change that.</p>
<h2>1st Step / Separating</h2>
<pre class="brush: php;">
&lt;?php if ($comments) : ?&gt;

	&lt;ol&gt;

	&lt;?php foreach ($comments as $comment) : ?&gt;

		&lt;?php
		$commentType = get_comment_type();
		if($commentType == 'comment') :
		?&gt;

			&lt;li id=&quot;comment-&lt;?php comment_ID() ?&gt;&quot; class='commentItem'&gt;
				&lt;!-- THE COMMENT LAYOUT --&gt;
			&lt;/li&gt;

		&lt;?php endif;/* end if comment check */ ?&gt;

	&lt;?php endforeach; /* end for each comment */ ?&gt;

	&lt;/ol&gt;

&lt;?php endif; ?&gt;
</pre>
<p><strong>get_comment_type</strong> is a function that returns &#8220;comment&#8221;, &#8220;trackback&#8221; or &#8220;pingback&#8221; depending what type the current <em>comment</em> is. </p>
<p>Now just copy paste the same code again and just change <em>&#8220;if($commentType == &#8216;comment&#8217;)&#8221;</em> to <em>if($commentType != &#8216;comment&#8217;)</em> which is the opposite of <em>&#8220;==&#8221;</em> and change the class from <em>&#8220;commentItem&#8221;</em> to <em>&#8220;trackbackItem&#8221;</em> so you can easily make different styles.</p>
<pre class="brush: php;">
&lt;?php if ($comments) : ?&gt;

	&lt;ol&gt;

	&lt;?php foreach ($comments as $comment) : ?&gt;

		&lt;?php
		$commentType = get_comment_type();
		if($commentType != 'comment') :
		?&gt;

			&lt;li id=&quot;comment-&lt;?php comment_ID() ?&gt;&quot; class='trackbackItem'&gt;
				&lt;!-- THE PINGS LAYOUT --&gt;
			&lt;/li&gt;

		&lt;?php endif;/* end if NOT comment check */ ?&gt;

	&lt;?php endforeach; /* end for each comment */ ?&gt;

	&lt;/ol&gt;

&lt;?php endif; ?&gt;
</pre>
<h2>2nd Step / The Layout</h2>
<p>Making the layout for pinbacks/trackbacks is very simple, there is only 1 function we are going to use, <strong>comment_author_link()</strong>. It just echoes the trackback/pingback link and that&#8217;s all we need.</p>
<pre class="brush: php;">
&lt;li id=&quot;comment-&lt;?php comment_ID() ?&gt;&quot; class='trackbackItem'&gt;
	&lt;?php comment_author_link(); ?&gt;
&lt;/li&gt;
</pre>
<p>That&#8217;s it. Styling is up to you <img src='http://wpcanyon.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p><em>Notice: The whole comments part is simplified for easier understanding of how to separate this, but you shouldn&#8217;t leave out the part where you check if the comment is awaiting moderation or comments are closed.</em></p>
<h2>Why separate?</h2>
<p>Thought about going through this before jumping into the code but i decided to put it at the end.</p>
<p>Let&#8217;s take a look at 2 screens i made.</p>
<h3>All mixed together</h3>
<p><img src='/post-images/separating_comments/bad.png' alt='bad' /></p>
<p><em>The screenshot above is taken from <a href='http://1stwebdesigner.com' target='_blank'>1stWebDesigner</a>.</em></p>
<p>The biggest problem in my opinion is that the conversation is broken and can become less useful. Another thing is that some articles can get a big amount of pings and push the comment to far down. And it doesn&#8217;t look nice, doesn&#8217;t it?</p>
<h3>Separated</h3>
<p><img src='/post-images/separating_comments/good.png' alt='good' /></p>
<p><em>The screenshot above is taken from the blog you are reading at the moment <img src='http://wpcanyon.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
<p>As you can see the conversation isn&#8217;t broken by the pings. The comment form won&#8217;t be pushed to far down if there are many pings. And it looks nice, doesn&#8217;t it? <img src='http://wpcanyon.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Let me know what you think about this.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tutorials/separating-trackbacks-and-pingbacks-from-comments-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>10 Effective Ways To Secure Your WordPress Blog</title>
		<link>http://wpcanyon.com/tutorials/10-effective-ways-to-secure-your-wordpress-blog/</link>
		<comments>http://wpcanyon.com/tutorials/10-effective-ways-to-secure-your-wordpress-blog/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 09:58:14 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=92</guid>
		<description><![CDATA[Every version comes with improvements, but until we get a completely secure WordPress version we have to find ways to improve the security ourselves. Here are 10 great ways to improve the security of your WordPress powered website.]]></description>
			<content:encoded><![CDATA[<h2>1. Place the WordPress files in a special folder</h2>
<p>A good way to secure yourself is not to place wordpress in the root directory, but to place it in a folder whose name is something meaningful only to you, or even something that even you don&#8217;t understand. Maybe some random word like <em>skidending</em>, you can always check the folder name via FTP.</p>
<p>After you do that, you will need to change some paths and transfer files to root so the blog can be accessed normally like http://theblogurl.com. Here is what you need to do:</p>
<ul>
<li>move <strong>index.php</strong> and <strong>.htaccess</strong> from the folder to the root directory.</li>
<li>Inside of the <strong>index.php</strong> file change <strong>require(&#8216;./wp-blog-header.php&#8217;)</strong> to <strong>require(&#8216;./folderName/wp-blog-header.php&#8217;)</strong></li>
</ul>
<p></p>
<h2>2. New administrator account, but keep the original&#8230;</h2>
<p><img src="/post-images/wpsec10/first.png" alt="account" /></p>
<p>No, this one isn&#8217;t like in every other &#8220;top x ways to secure wordpress&#8230;&#8221;. We&#8217;re not gonna delete the admin account.</p>
<p>Make a new account with any username you like, give it full privileges, then login with that new account, and change the privileges of the admin username to <em>subscriber</em>. That&#8217;s better then deleting the admin account.</p>
<p>Why? Because hacker or bot or whatever will first check for the admin username, and if it doesn&#8217;t exists wordpress will say so in the error, but if it does exists he will believe that&#8217;s the real administrator account and he will try to break the code for it. Even if he manages to do it, he&#8217;s logged in as a subscriber, he can&#8217;t do any harm at all. So we&#8217;re basically misleading him in a wrong direction. </p>
<p></p>
<h2>3. Limit failed login attempts</h2>
<p><img src='/post-images/wpsec10/pic3.png' alt='failed attempt' /></p>
<p>You probably won&#8217;t need 5 times to successfully login to the admin panel, and the person who wants to access the admin panel will need more then 5 times.</p>
<p>So, how to limit login attempts? There is a pretty good plugin to help you out limit them easily. It&#8217;s <a href='http://wordpress.org/extend/plugins/login-lockdown/'>Login LockDown</a>. There are few options you can select like amount of unsuccessful login attempts in a certain period of time, and the &#8220;ban&#8221; time.</p>
<p></p>
<h2>4. Update, update, update</h2>
<p><img src='/post-images/wpsec10/pic4.png' alt='updates' /></p>
<p>This is very important. As soon as a new update comes for WordPress or Theme or Plugin backup your database and click the update button without hesitating. Besides some cool features that might have been added to wordpress in that new version there is a big chance that some big security hole is fixed.</p>
<p></p>
<h2>5. Use WordPress plugins for security</h2>
<p>There a lot of plugins out there that improve security of wordpress by fixing some of it&#8217;s known flaws.</p>
<p>Here are some of them:</p>
<ul>
<li><a href='http://wordpress.org/extend/plugins/stealth-login/'>Stealth login</a></li>
<li><a href='http://wordpress.org/extend/plugins/askapache-password-protect/'>AskApache password protect</a></li>
<li><a href='http://wordpress.org/extend/plugins/wp-security-scan/'>WP Security Scan</a></li>
<ul>
<p>I&#8217;m not going to explain how they work, check the description on the plugin page, but you can expect a special article on wordpress plugins for improving security.</p>
<p></p>
<h2>6. Use .htaccess</h2>
<p>.htaccess is a really powerful file, and one of it&#8217;s many abilities is security.</p>
<p><strong>Here is one example which will allow access to wp-admin only for a specific IP Address.</strong><br />
<code><br />
order deny,allow<br />
allow from 123.123.123.123<br />
deny from all<br />
</code><br />
<em>If you have dynamic IP address this won&#8217;t be much useful to you. Change the numbers on line 2 with your ip address. The .htaccess file with these lines should be placed in the wp-admin folder.</em></p>
<p>There are a lot of ways to protect it with .htaccess, and an article on <a href="http://wpshout.com">WpShout.com</a> called <a href="http://wpshout.com/a-to-z-of-wordpress-htaccess-hacks/">A to Z of WordPress .htaccess hacks</a> explains quite a few of them.</p>
<p></p>
<h2>7. Make database backups</h2>
<p>You can&#8217;t be 100% secure, no one can. Imagine you have about 100 posts, and a hacker somehow finds a way in and deletes everything. What can you do then? Nothing if you don&#8217;t have the database backup. It takes a min to make a backup and who knows how much time to write all the post again.</p>
<p>You can easily make a backup using phpmyadmin , but if you don&#8217;t know how there are also a lot of <a href="http://wordpress.org/extend/plugins/search.php?q=backup">plugins that can do that instead of you</a>. </p>
<p></p>
<h2>8. Make a good password</h2>
<p>Yes i know, you&#8217;re sick and tired from this tip. But having a good password is a MUST. And with the 2nd tip (new account), this could be great. Make a password without any meaning, completely random.</p>
<p>So 2nd + this one = Pain in the ass for anyone trying to hack into your admin by pass guessing.</p>
<p>Over at <a href="http://pctools.com">pctools.com</a> there is a really nice <a href="http://www.pctools.com/guides/password/">random password generator</a>.</p>
<p></p>
<h2>9. Authentication Unique Keys in wp-config.php </h2>
<p>A lot of wordpress users probably forget this. In wp-config.php there are 4 lines:</p>
<p><code><br />
define('AUTH_KEY', 'put your unique phrase here');<br />
define('SECURE_AUTH_KEY', 'put your unique phrase here');<br />
define('LOGGED_IN_KEY', 'put your unique phrase here');<br />
define('NONCE_KEY', 'put your unique phrase here');<br />
</code></p>
<p>In order to be secured you must change the values of those 4 keys. The wordpress website has a <a href="http://api.wordpress.org/secret-key/1.1/">nice random generator</a> specially made for these 4 lines. </p>
<p></p>
<h2>10. Change the wp_ table prefix</h2>
<p>The default prefix for tables in the database is &#8220;wp_&#8221; and it&#8217;s advisable to change it to something else. You can use the <a href='http://wordpress.org/extend/plugins/wp-security-scan/' target='_blank'>WP Security Scan</a> plugin to do that and a lot more on improving security.</p>
<p></p>
<h2>Final Words</h2>
<p>That&#8217;s it. I hope these 10 ways helped or will help you to increase the security of your wordpress powered website. Good luck&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tutorials/10-effective-ways-to-secure-your-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>How To Use The Post Thumbnail Feature In WordPress 2.9</title>
		<link>http://wpcanyon.com/tutorials/how-to-use-the-post-thumbnail-feature-in-wordpress-2-9/</link>
		<comments>http://wpcanyon.com/tutorials/how-to-use-the-post-thumbnail-feature-in-wordpress-2-9/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 07:57:57 +0000</pubDate>
		<dc:creator>Boba</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://wpcanyon.com/?p=48</guid>
		<description><![CDATA[Wordpress version 2.9 comes with many improvements, one of them is something that should have been available for a long time, the post thumbnails. Here is how to use it.]]></description>
			<content:encoded><![CDATA[<p>Until now there was no feature in WordPress to allow you to post thumbnails, so we had to use custom fields or plugins or embed a picture inside the content to act as a thumbnail (that&#8217;s what i did when i first started with wordpress). The new version comes with that feature.</p>
<p>I assume you know what a post thumbnail is, you do know, right? Ohh ok, sorry, had to ask. Well let&#8217;s get to the point.</p>
<p>We will go through 3 simple steps in this tutorial.</p>
<ul>
<li><strong>First</strong> &#8211; <em>Activating thumbnail feature</em></li>
<li><strong>Second</strong> &#8211; <em>Adding thumbnail to a post</em></li>
<li><strong>Third</strong> &#8211; <em>Showing the thumbnail in a theme</em></li>
</ul>
<h2>1. Activating The Feature</h2>
<p>Add the code bellow to the <strong>functions.php</strong> file in your theme folder.</p>
<pre class="brush: php;">add_theme_support(‘post-thumbnails’);</pre>
<p>There is another function for thumbnails, and it&#8217;s used to automatically resize the image you set to be the thumbnail, so if you want your thumbnail to be exactly the same as the image you uploaded feel free to skip to second step. </p>
<p>That function is set_post_thumbnail_size(), which you call after the add_theme_support() function and if called, the image you have set as the thumbnail will be automatically resized. You can declare 3 variables inside of it, width, height and cropping. Cropping is set to false by default so it&#8217;s not required. </p>
<pre class="brush: php;">set_post_thumbnail_size(150, 100);</pre>
<p>With the code above your thumbnail will be resized to approx 150px wide and 100px tall, keeping the aspect ratio. So the resized image will be closest to or exactly 150&#215;100 which depends on the original size.</p>
<pre class="brush: php;">set_post_thumbnail_size(150, 100, true);</pre>
<p>With the code above your thumbnail will be resized to exactly 150px wide and 100px tall, but you might loose a part of the image, because it&#8217;s cropped.</p>
<h2>2. Adding Thumbnail To A Post</h2>
<p>Go to your admin dashboard and either go to create a new post or edit existing one.</p>
<p><em>Notice: If you are creating a new post, first fill the title field so it can save the draft, otherwise you can&#8217;t add a thumbnail.</em></p>
<p><img src='http://wpcanyon.com/post-images/post_thumbnail/pic1.png' alt='dashboard' /></p>
<p>Click on the <em>set thumbnail</em> link, and you will get the same modal window like when you are adding an image. Now upload an image and when done you will see this.</p>
<p><img src='http://wpcanyon.com/post-images/post_thumbnail/pic2.png' alt='dashboard' /></p>
<p>Click the <em>use as thumbnail</em> link and in few seconds you will see the thumbnail tab gets updated with the thumbnail like on the next screenshot.</p>
<p><img src='http://wpcanyon.com/post-images/post_thumbnail/pic3.png' alt='dashboard' /></p>
<h2>3. Show it </h2>
<p>The code bellow is used to echo the post thumbnail image. </p>
<pre class="brush: php;">the_post_thumbnail();</pre>
<p>But for example if you have a div wrapping the thumbnail, and you haven&#8217;t set a thumbnail for some post, then you will get an empty div. So it&#8217;s advised to run a little if statement to check if the post has a thumbnail.</p>
<pre class="brush: php;">
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
</pre>
<p>Congrats, you have added thumbnails feature to your blog.</p>
<h2>Some additional codes</h2>
<p>Well, one more if statements is suggested, just to make sure the theme is running on WordPress version that can use <em>add_theme_support()</em> function which is introduced in 2.9. I&#8217;m not using it on my blog because i know i won&#8217;t downgrade it to an older version.</p>
<p>1. The activating</p>
<pre class="brush: php;">
if ( function_exists( 'add_theme_support' ) ){
add_theme_support(‘post-thumbnails’);
//and add the resizing function here if you need it
}
</pre>
<p>2. The Showing</p>
<pre class="brush: php;">
if ( function_exists( 'add_theme_support' ) &amp;&amp; has_post_thumbnail()){
the_post_thumbnail();
}
</pre>
<p>You might also want to check a <a href='http://net.tutsplus.com/tutorials/wordpress/quick-tip-how-to-use-the-new-post-thumbnail-feature-in-wordpress-2-9/' target='_blank'>screencast</a> made by Jeffrey Way on setting up and using the feature.</p>
<h2>Final Words</h2>
<p>That&#8217;s it, i hope you learned something from this tutorial. If i made a mistake somewhere or you think there is a better way to achieve some part feel free to say so in the comments. </p>
]]></content:encoded>
			<wfw:commentRss>http://wpcanyon.com/tutorials/how-to-use-the-post-thumbnail-feature-in-wordpress-2-9/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>

