<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>The WordPress Freelancer</title>
	
	<link>http://wplancer.com</link>
	<description>Freelance WordPress theme developer par excellence</description>
	<lastBuildDate>Sat, 18 May 2013 09:40:27 +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>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/wplancer" /><feedburner:info uri="wplancer" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>wplancer</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Infinite next and previous post looping in WordPress</title>
		<link>http://feedproxy.google.com/~r/wplancer/~3/QyQ6arJOX_Q/</link>
		<comments>http://wplancer.com/infinite-next-and-previous-post-looping-in-wordpress/#comments</comments>
		<pubDate>Sat, 18 May 2013 09:40:27 +0000</pubDate>
		<dc:creator>Baki Goxhaj</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Editor's Picks]]></category>
		<category><![CDATA[Loop]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Without a Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://banago.net/wplancer/?p=1399</guid>
		<description><![CDATA[It has happened to me several times in my career as a WordPress freelancer to be in need of a infinite next and previous post looping in WordPress. And I have a solution for that. By default WordPress will show no previous post link when you are viewing the first post and no next post link when you are viewing the last post. But there are cases when an apparently infinite looping is needed. To achieve that, what we practically need to do is when viewing the first post, the previous post link will jump you to the last post ...]]></description>
				<content:encoded><![CDATA[<p>It has happened to me several times in my career as a WordPress freelancer to be in need of a infinite next and previous post looping in WordPress. And I have a solution for that.</p>
<p>By default WordPress will show no <em>previous post link</em> when you are viewing the first post and no <em>next post link</em> when you are viewing the last post. But there are cases when an apparently infinite looping is needed. To achieve that, what we practically need to do is when viewing the first post, the <em>previous post link</em> will jump you to the last post and when viewing the last post the <em>next post link</em> will jump to the first post.</p>
<p>The only issue that arises at this point is how do we know that we are are viewing the <em>first post</em> or the <em>last post</em>.<em> </em>WordPress comes to help at this point by providing the <a target="_blank" title="Retrieve adjacent post" href="http://codex.wordpress.org/Function_Reference/get_adjacent_post"><em>get_adjacent_post()</em></a>. This function allows us to check if there is a next or previous post or not, and if there is not, we will provide one by querying the appropriate one with <a target="_blank" title="WP_Query is a class that deals with the intricacies of a posts request to WordPress." href="http://codex.wordpress.org/Class_Reference/WP_Query"><em>WP_Query()</em></a>.</p>
<p>Here is the <a target="_blank" title="Infinite next and previous post looping in WordPress" href="https://gist.github.com/banago/5603826">finished code</a>:</p>
<script src="https://gist.github.com/5603826.js"></script><noscript><pre><code class="language-php php">&lt;?php 
/**
 *  Infinite next and previous post looping in WordPress
 */
if( get_adjacent_post(false, '', true) ) { 
	previous_post_link('%link', '&amp;larr; Previous Post');
} else { 
    $first = new WP_Query('posts_per_page=1&amp;order=DESC'); $first-&gt;the_post();
    	echo '&lt;a href=&quot;' . get_permalink() . '&quot;&gt;&amp;larr; Previous Post&lt;/a&gt;';
  	wp_reset_query();
}; 
    
if( get_adjacent_post(false, '', false) ) { 
	next_post_link('%link', 'Next Post &amp;rarr;');
} else { 
	$last = new WP_Query('posts_per_page=1&amp;order=ASC'); $last-&gt;the_post();
    	echo '&lt;a href=&quot;' . get_permalink() . '&quot;&gt;Next Post &amp;rarr;&lt;/a&gt;';
    wp_reset_query();
}; </code></pre></noscript>
<p>I hope this was helpful. Until next time, stay blessed!</p>
<img src="http://feeds.feedburner.com/~r/wplancer/~4/QyQ6arJOX_Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://wplancer.com/infinite-next-and-previous-post-looping-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://wplancer.com/infinite-next-and-previous-post-looping-in-wordpress/</feedburner:origLink></item>
		<item>
		<title>Access an object as an array in PHP</title>
		<link>http://feedproxy.google.com/~r/wplancer/~3/PJTAg-sadkw/</link>
		<comments>http://wplancer.com/access-an-object-as-an-array-in-php/#comments</comments>
		<pubDate>Fri, 17 May 2013 04:28:00 +0000</pubDate>
		<dc:creator>Baki Goxhaj</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Array]]></category>
		<category><![CDATA[Object]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Type Casting]]></category>

		<guid isPermaLink="false">http://banago.net/wplancer/?p=1378</guid>
		<description><![CDATA[Have you ever been in that position when you are working with an PHP object and you need only one single peace of the data it contains and you want to skip all that iteration part and access that data directly. I have. It is very easy to do in an array by using the index or the key as it is usually called. So to access the first item of an array in PHP without iterating over it you would do something like this: echo $array[0] It gets more complicated with nested arrays: echo $array[0][0] //Numbered Indexs echo $array['item']['subitem'] ...]]></description>
				<content:encoded><![CDATA[<p>Have you ever been in that position when you are working with an PHP object and you need only one single peace of the data it contains and you want to skip all that iteration part and access that data directly. I have.</p>
<p>It is very easy to do in an array by using the index or the key as it is usually called. So to access the first item of an array in PHP without iterating over it you would do something like this:</p>
<pre class="code">echo $array[0]</pre>
<p>It gets more complicated with nested arrays:</p>
<pre class="code">echo $array[0][0] //Numbered Indexs

echo $array['item']['subitem'] //String Indexes

echo $array[0]['item'] //Mixed Indexes</pre>
<p>But we have an object to access, right? And the good news is we can do it with an object too. Here is my favourite way of doing it with an object:</p>
<pre class="code"><code>$object-&gt;{'0'}-&gt;item</code></pre>
<p>Or you can cast the type from an object to an array like this:</p>
<pre class="code"><code>$array = (array) $object;
$array[0]-&gt;item;</code></pre>
<p>But this feels kind of hack-ish and I&#8217;ve not heard good words about this method. Since the first method is pretty neat, I suggest you go with that.</p>
<p>This is it for this post. Until next time, stay blessed!</p>
<img src="http://feeds.feedburner.com/~r/wplancer/~4/PJTAg-sadkw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://wplancer.com/access-an-object-as-an-array-in-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://wplancer.com/access-an-object-as-an-array-in-php/</feedburner:origLink></item>
		<item>
		<title>Without a Plugin: Display Recent Comments</title>
		<link>http://feedproxy.google.com/~r/wplancer/~3/yxjEM07aQKs/</link>
		<comments>http://wplancer.com/how-to-display-recent-comments-without-using-a-plugin-or-widget/#comments</comments>
		<pubDate>Sat, 22 Dec 2012 07:00:04 +0000</pubDate>
		<dc:creator>Baki Goxhaj</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Comments]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Widget]]></category>
		<category><![CDATA[Without a Plugin]]></category>

		<guid isPermaLink="false">http://www.wplancer.com/?p=603</guid>
		<description><![CDATA[This post was originally published on April 9, 2009 and is now being being republished as it has been entirely revised. The original method is removed and now replaced by a brand new one. WordPress ships with a Recent Comments widget, which is very handy, but on the other hand does not give you much freedom in terms of look and feel. There are plugins out there with will offer some more functionallity, but you sometimes feel you just want to free yourself form any limitations. So here I present the recent comments function. Let&#8217;s get our hands dirty. Here is ...]]></description>
				<content:encoded><![CDATA[<div class="alert yellow">This post was originally published on April 9, 2009 and is now being being republished as it has been <em>entirely revised</em>. The original method is removed and now replaced by a brand new one.</div>
<p>WordPress ships with a <em>Recent Comments</em> widget, which is very handy, but on the other hand does not give you much freedom in terms of look and feel. There are plugins out there with will offer some more functionallity, but you sometimes feel you just want to free yourself form any limitations. So here I present the recent comments function. Let&#8217;s get our hands dirty.</p>
<p>Here is the function that you need to put in your <em>functions.php </em> file.</p>
<script src="https://gist.github.com/c1a04efce6ebb79a6474.js?file=recent-comments.php"></script><noscript><pre><code class="language-php php">&lt;?php
/**
 * Show Recent Comments
 *
 * @author Baki Goxhaj
 * @link http://wplancer.com/how-to-display-recent-comments-without-using-a-plugin-or-widget/ 
 *
 * @param string/integer $no_comments
 * @param string/integer $comment_len
 * @param string/integer $avatar_size
 * 
 * @echo string $comm
 */
function bg_recent_comments($no_comments = 5, $comment_len = 80, $avatar_size = 48) {

  $comments_query = new WP_Comment_Query();
	$comments = $comments_query-&gt;query( array( 'number' =&gt; $no_comments ) );
	
	$comm = '';
	if ( $comments ) : foreach ( $comments as $comment ) :
		$comm .= '&lt;li&gt;' . get_avatar( $comment-&gt;comment_author_email, $avatar_size );
		$comm .= '&lt;a class=&quot;author&quot; href=&quot;' . get_permalink( $comment-&gt;post_ID ) . '#comment-' . $comment-&gt;comment_ID . '&quot;&gt;';
		$comm .= get_comment_author( $comment-&gt;comment_ID ) . ':&lt;/a&gt; ';
		$comm .= '&lt;p&gt;' . strip_tags( substr( apply_filters( 'get_comment_text', $comment-&gt;comment_content ), 0, $comment_len ) ) . '&lt;/p&gt;&lt;/li&gt;';
	endforeach; else :
		$comm .= 'No comments.';
	endif;
	
	echo $comm;	
}</code></pre></noscript>
<p>The function has three arguments that allow you to specify the number of comments that you want to show, defaulting to 5; how long you want the comment body text to be, defaulting in 120 characters; and how big you want your gravatar to be, from 0 to 100, defaulting to 48.</p>
<p>Next you want to call the function from the <em>sidebar.php</em> of your theme or wherever else you want them to show on your site. You can do it like this:</p>
<script src="https://gist.github.com/c1a04efce6ebb79a6474.js?file=recent-comments.html"></script><noscript><pre><code class="language-html html">&lt;div class=&quot;widget recent-comments&quot;&gt;
    &lt;h3&gt;Recent Comments&lt;/h3&gt;
    &lt;?php bg_recent_comments(); ?&gt;
&lt;/div&gt;</code></pre></noscript>
<p>And here I&#8217;m offering you some boilerplate CSS styles to make your recent comments look good.</p>
<script src="https://gist.github.com/c1a04efce6ebb79a6474.js?file=recent-comments.css"></script><noscript><pre><code class="language-css css">.recent-comments { list-style: none; font-size: 12px; color: #485358; }
.recent-comments li { overflow: hidden; padding: 20px 0; border-top: 1px dotted #DADEE1; }
.recent-comments li:first-child { border: 0 none; }
.recent-comments img { float: left; margin-right: 8px; } 
.recent-comments a { display: block; margin-top: 10px; padding-top: 10px; text-transform: uppercase; } </code></pre></noscript>
<p>I wish you find this article helpful and please make sure to subscribe as more stuff is coming in the <em>Without a Plugin</em> series.</p>
<img src="http://feeds.feedburner.com/~r/wplancer/~4/yxjEM07aQKs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://wplancer.com/how-to-display-recent-comments-without-using-a-plugin-or-widget/feed/</wfw:commentRss>
		<slash:comments>79</slash:comments>
		<feedburner:origLink>http://wplancer.com/how-to-display-recent-comments-without-using-a-plugin-or-widget/</feedburner:origLink></item>
		<item>
		<title>Introduction to terminal</title>
		<link>http://feedproxy.google.com/~r/wplancer/~3/vNyOhWWvjFM/</link>
		<comments>http://wplancer.com/a-beginners-guide-to-the-command-line/#comments</comments>
		<pubDate>Fri, 21 Dec 2012 11:41:47 +0000</pubDate>
		<dc:creator>Baki Goxhaj</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Editor's Picks]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Commad Line]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Terminal]]></category>

		<guid isPermaLink="false">http://banago.net/wplancer/?p=1309</guid>
		<description><![CDATA[I&#8217;m an Ubuntu user for a long time now, a little more than four years. I switched to Linux from Windows and didn&#8217;t have a clue about the terminal and how to use it. Since I could do almost everything by pointing and clicking, I did not find the CLI an attraction at first. But, through the years, I&#8217;ve grown to give it the love it deserves. I&#8217;m writing this because I think you should learn to use the terminal. You cannot imagine what a great tool it is and how much more and much faster you can do through ...]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m an Ubuntu user for a long time now, a little more than four years. I switched to Linux from Windows and didn&#8217;t have a clue about the terminal and how to use it. Since I could do almost everything by pointing and clicking, I did not find the <abbr title="Command Line Interface">CLI</abbr> an attraction at first. But, through the years, I&#8217;ve grown to give it the love it deserves.</p>
<p>I&#8217;m writing this because I think you should learn to use the terminal. You cannot imagine what a great tool it is and how much more and much faster you can do through it. Also, you should learn to use Git, which is a lot easier to learn if you know a couple of terminal commands. I&#8217;m looking at you <a title="Sven Salmonsson, my partner" href="http://wplancer.com/your-job-is-to-put-yourself-out-of-work/">Sven</a>.</p>
<p>In the quest of trying to make this as practical and enjoyable as possible, I&#8217;m going to guide through a real-life scenario I do very often. Let&#8217;s start.</p>
<p><img src="http://wplancer.com/files/2012/12/introduction-to-terminal-2-680x335.png" alt="introduction to terminal" class="aligncenter size-large wp-image-1339" height="335" width="680" /></p>
<h2>The Scenario</h2>
<p>I&#8217;m going to start building a new <a title="WordPress Consultant" href="http://wplancer.com/wordpress-freelance-services/">WordPress theme for a client.</a> To do so I&#8217;m going to grab <a title="Base - Starter WordPress Theme" href="https://github.com/banago/base">Base</a>, my starter theme from Github and put it inside my themes directory under <em>Public/intro-to-terminal/wp-content/themes/ </em>directory. Afterwards, we start learning.</p>
<p>This is the scenario:</p>
<p>I <strong>browse to</strong> the <em>base </em>directory and <strong>view the files</strong> it contains. I check if it contains any <strong>hidden</strong> files too. After  that, I <strong>copy</strong> the contents of <em>index.php</em> into another file named <em>home.php.</em> Then, I <strong>rename</strong> <em>hom.php </em>into <em>home.php</em> because I typed it wrong the first time. <strong></strong>Then I <strong>create a directory</strong><strong></strong> named <em>dev</em> and I <strong>move</strong> <em>comments.php</em> file <em></em> into that because I don&#8217;t need it. I <strong>delete</strong> <em>readme.md </em>file altogether since it&#8217;s just for Github. After that, I go <strong>back one directory</strong>, and I <strong>copy the <em>base</em> directory</strong> into another directory named <em>awesome-project </em>and <strong>delete the original base directory</strong> and its contents.</p>
<p>Let&#8217;s recap. What we are going to learn to do through the terminal is:</p>
<ol>
<li>Browse to a directory</li>
<li>View contents of a directory, hidden files too</li>
<li>Copy the contents of a file into another file</li>
<li>Rename a file</li>
<li>Create a directory</li>
<li>Move a file into a directory</li>
<li>Delete a file</li>
<li>Go back one directory</li>
<li>Copy the contents of a directory into another directory</li>
<li>Delete a directory</li>
</ol>
<p>This is the 20% of knowledge you are going to need 80% of the time. Read it through and you won&#8217;t regret the time.</p>
<h2>Browse to a directory</h2>
<p>To browse to a certain directory we use the <strong>cd</strong> command. It stands for &#8220;change directory&#8221;.  So, in terminal we write:</p>
<pre class="code">cd Public/wp-content/themes/base</pre>
<p>And hit Enter. That will run the command. And instantly we will be inside the <em>base</em> directory.</p>
<div class="alert white yellow">If you find writing the path tedious, it really is. But fear not, the terminal will help you. All you have to do is write the first letter of the directory name and hit <em>tab </em>key. That will auto-complete the name and save you a lot of time. You will have to enter more then one letter if you have directories starting with the same letter.</div>
<h2>View contents of a directory</h2>
<p>To view the contents of the directory we are in, all we have to do is run the <em>ls</em> command, meaning &#8220;list&#8221;.</p>
<pre class="code">ls</pre>
<p>To view the hidden files too, just add the <em>-a </em>argument to the <em>ls </em>and you will be shown the hidden files too. Easy, huh? Yep, it is. Every time I need to show hidden files in Windows, I hit Google to find out how to do it. Thankfully that is not very often.</p>
<pre class="code">ls -a</pre>
<h2>Copy the contents of a file into another file</h2>
<p>We now want to copy the contents of <em>index.php </em>into <em>home.php</em>. The command we use in this case is <strong>cp</strong>, which stands for <em>copy</em>. It takes the original file name as first argument and the target file name as second argument.</p>
<pre class="code">cp index.php hom.php</pre>
<p>Spelling mistake is intentional &#8212; keep reading. You can run <em>ls </em>to check whether the command was successful or not. And sure it was.</p>
<h2>Rename a file</h2>
<p>Now we want to rename the &#8220;mistakenly&#8221;  misspelled <em>hom.php </em>into <em>home.php. </em>To do that we use the <strong>mv</strong> command which stands for <em>move</em>. I guess you expected to use something else, like a shorten version of the word <em>rename</em>. Well, that&#8217;s not the case. And renaming is nothing more than moving the contents of a file from an old on to a new one with a new name. Here:</p>
<pre class="code"><code>mv hom.php home.php</code></pre>
<p>It&#8217;s that easy. Check what happened. You should know what command to check that with.</p>
<h2>Create a directory</h2>
<p>Now I want to create a directory named <em>dev</em> where I want to move files that are only for development purpose. We create a directory using the <strong>mkdir</strong> command adding the name of the directory as its first argument.</p>
<pre class="code">mkdir dev</pre>
<p><strong></strong>That will do. Check it out &#8212; <em>ls<strong>.</strong></em></p>
<h2><strong></strong>Move a file into a directory</h2>
<p>This particular project of mine won&#8217;t have comments, so I don&#8217;t want the <em>comments.php </em>around, but I don&#8217;t want to delete them either, so let&#8217;s move them into the newly created <em>dev </em>directory. To do it, we use the <em>rename</em> command, i.e. <em>mv</em>. Makes sense?</p>
<pre class="code">mv comments.php dev/comments.php</pre>
<p>Isn&#8217;t that cool? So, we want to check if the <em>comments.php </em>file really ended inside the <em>dev</em> directory. We can do that from our current location without needing to <strong>cd</strong> (change directory) into the <em>dev</em> folder.</p>
<pre class="code">ls dev/</pre>
<p><strong></strong>Remember this trick. You can replace the <em>ls</em> command with other commands without having the need to change directory. You cannot do that with mouse, right?</p>
<h2>Delete a file</h2>
<p>There is one particular file we don&#8217;t want to have around and that is the <em>readme.md</em> that Github uses to show information about the project. To get rid of it, we use the <em>rm</em> command which, as you can guess, stands for <em>remove.</em></p>
<pre class="code">rm readme.md</pre>
<p>This won&#8217;t take the file into trash, but will instead delete it once and for all. <span class="highlight">Use with caution.</span></p>
<h2>Go back one directory</h2>
<p><strong></strong>Why is going back important? Because the past shapes our future my friend. We want to move one directory up, in other words one directory back, because we want to rename the actual directory. And going one directory back is really easy.</p>
<pre class="code">cd ..</pre>
<p>Yes, that&#8217;s it, two dots. Two dots means exactly one directory back. Run <em>ls</em> to check you really are one directory up.</p>
<h2>Copy the contents of a directory into another directory</h2>
<p>This is straightforward, right? We already know how to copy the contents of a file into anther file. Half-right, because this is a directory, but the command is the same, <strong>cp</strong>, it just needs an extra argument, <em>-</em><em>r</em>, which means recursive, which means copy all the files and folders inside it too.</p>
<pre class="code">cp -r base project-name</pre>
<p>Isn&#8217;t that cool?</p>
<h2>Delete a directory</h2>
<p>Now we want to get rid of that original directory, right? I guess you now know what we will do here:</p>
<pre class="code">rm -r base/</pre>
<p>That&#8217;s right, we just add the <em>-r </em>because it&#8217;s a directory and we are done. Once again, rm won&#8217;t take the directory to trash, it will just delete it forever.</p>
<p>Bonus: Why rename directories in two steps</p>
<p>That&#8217;s right, we don&#8217;t need to. I just wanted to teach you copying and deleting recursively, otherwise, here it is how we would rename a directory in the terminal in the real world.</p>
<pre class="code">mv -r base/ project-name/</pre>
<p>This is it, the most basic and practical tutorial on how to use terminal you will find on the Internet. We learned how to do routine stuff that we do everyday with a mouse through the terminal and enjoy it.</p>
<p>My final word is, terminal&#8217;s got potential, don&#8217;t underestimate it.</p>
<img src="http://feeds.feedburner.com/~r/wplancer/~4/vNyOhWWvjFM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://wplancer.com/a-beginners-guide-to-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://wplancer.com/a-beginners-guide-to-the-command-line/</feedburner:origLink></item>
		<item>
		<title>What has been going on at WPlancer</title>
		<link>http://feedproxy.google.com/~r/wplancer/~3/xOGXHQribaU/</link>
		<comments>http://wplancer.com/what-has-been-going-on-at-wplancer/#comments</comments>
		<pubDate>Wed, 19 Dec 2012 09:44:13 +0000</pubDate>
		<dc:creator>Baki Goxhaj</dc:creator>
				<category><![CDATA[Editor's Picks]]></category>
		<category><![CDATA[MonsterThemes]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Peronal Life]]></category>
		<category><![CDATA[PHP Frameworks]]></category>
		<category><![CDATA[Professional Development]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://banago.net/wplancer/?p=1110</guid>
		<description><![CDATA[Long time, no word. That&#8217;s pretty lame, I know. Especially of you are trying to build an audience around your blog. But as you may have noticed, I&#8217;m coming back to it. So, let&#8217;s get into the details right away. Little has been happening on this blog for the last year and a half, but a lot has been going on the backstage. The main reason I&#8217;ve been reluctant to publish new stuff is mainly because I&#8217;ve been pretty busy. WPlancer.Com turned into such a great site for me that it kept bringing prospects at my door until I got ...]]></description>
				<content:encoded><![CDATA[<p>Long time, no word. That&#8217;s pretty lame, I know. Especially of you are trying to build an audience around your blog. But as you may have noticed, I&#8217;m coming back to it. So, let&#8217;s get into the details right away.</p>
<p>Little has been happening on this blog for the last year and a half, but a lot has been going on the backstage.</p>
<p>The main reason I&#8217;ve been reluctant to publish new stuff is mainly because I&#8217;ve been pretty busy. WPlancer.Com turned into such a great site for me that it kept bringing prospects at my door until I got so busy that blogging became something I never found time for. But deep down I knew I had to get back to it. And finally it seems I could.</p>
<h2>Client Work</h2>
<p><a title="WordPress Consulting" href="http://wplancer.com/wordpress-freelance-services/">Consulting</a> work had been great. I&#8217;ve had a steady workload and have made a couple of great partners. But my time management abilities have not been on the same height. Sometimes I&#8217;d miss deadlines and get stressed to finish everything on time. But I&#8217;m on a self-improvement quest all the time and have managed to pull myself together and plant my work better and have a work &#8211; life balance that works.</p>
<h2>New Office</h2>
<p><strong></strong>I&#8217;ve had an office space for a long time now, but I still enjoyed working from home and I did so most of the time. But enough is enough &#8211; I kicked myself out of home and into the office so that I could have a more balanced life. I love working from an office space but I still miss the working-from-home relaxed experience and I stay there once in a while.</p>
<h2>MonsterThemes</h2>
<p>After several attempts to get into the <a target="_blank" title="Premium WordPress Themes" href="http://monsterthemes.com/">premium themes</a> business, I started a partnership with a great guy from Sweden &#8211; <a target="_blank" title="Sven Salmonsson, my partner" href="http://svensalmonsson.com/">Sven</a> and built MonsterThemes, the premium themes shop with him. It has been a great experience this far and I intend to write on this more extensively soon.</p>
<h2>PHP Framework(s)</h2>
<p>I&#8217;ve been involved in the development of a new PHP <a title="Psyche PHP Framework" href="https://github.com/fadion/Psyche">framework</a>, for fun and profit. Even though I&#8217;ve not been able to write much code until now, I love the thing and the experience. I&#8217;ve also been looking into <a target="_blank" title="Laravel PHP Framework" href="http://www.laravel.com/">Laravel</a>, another PHP Framework, and have been building some cool stuff with it.</p>
<h2>Professional Development<!--BEGIN .toggle --></h2>
<h2><!--END .toggle --></h2>
<p>I have been constantly trying to improve my skills and expand my skill-set and I&#8217;ve successfully done so on several directions. I taught myself Git and I cannot believe how I did it before without it. I love jQuery and find it great to develop in it, but I thought I&#8217;d go a bit deeper and teach myself good old JavaScript. And I&#8217;m now confident in PHP object oriented programming. I use the terminal all the time now and have taught myself some Bash, which I find a great asset to have available. But WordPress remains my gem.</p>
<h2>Personal Life</h2>
<p>2011 was not a very nice year to me. My dear sister had a very harsh head operation, my wise father passed away, and one of my brother&#8217;s family was almost torn in pieces. But expect losing my father, the rest is back to normal now thankfully. 2012 has been quite a good year. I moved in with my <a title="Smart Center" href="http://smartcenter.al/">beautiful fiancée</a> on our own apartment and are finally finishing furnishing it.</p>
<p>I guess I said it all, wanting to keep the length of this post under control. But more is coming and, trust me, it&#8217;s going to be good &#8211; so you better subscribe below.</p>
<p>Until next time, I&#8217;m Baki and I&#8217;m signing off.</p>
<img src="http://feeds.feedburner.com/~r/wplancer/~4/xOGXHQribaU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://wplancer.com/what-has-been-going-on-at-wplancer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://wplancer.com/what-has-been-going-on-at-wplancer/</feedburner:origLink></item>
		<item>
		<title>What I would take out of WordPress</title>
		<link>http://feedproxy.google.com/~r/wplancer/~3/6XqE9DE3-EA/</link>
		<comments>http://wplancer.com/what-i-would-take-out-of-wordpress/#comments</comments>
		<pubDate>Sun, 16 Dec 2012 22:32:41 +0000</pubDate>
		<dc:creator>Baki Goxhaj</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[Trends]]></category>
		<category><![CDATA[Blogroll]]></category>
		<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Press This]]></category>
		<category><![CDATA[Profile]]></category>
		<category><![CDATA[Turbo]]></category>

		<guid isPermaLink="false">http://www.wplancer.com/?p=1004</guid>
		<description><![CDATA[This post was meant to be posted a long time ago and WordPress has come a long way since then. So much so that some of the points in this post are already done. But I&#8217;m still getting this out of the door. Back then, I was listening to a WPTavern podcast with Kim Parsell, where she mentioned that WordPress was going to get slimmer on the coming releases. And she was right speaking from the future. Here goes the list of stuff I thought and still think should go out of WordPress: Links &#8211; aka Blogroll This functionality has ...]]></description>
				<content:encoded><![CDATA[<p>This post was meant to be posted a long time ago and WordPress has come a long way since then. So much so that some of the points in this post are already done. But I&#8217;m still getting this out of the door.</p>
<p>Back then, I was listening to a <a target="_blank" title="WPTavern Podcact" href="http://www.wptavern.com/wpweekly-episode-98-%E2%80%93-wordpress-3-0-and-wordcamp-san-francisco">WPTavern podcast</a> with Kim Parsell, where she mentioned that WordPress was going to get slimmer on the coming releases. And she was right speaking from the future.</p>
<p>Here goes the list of stuff I thought and still think should go out of WordPress:</p>
<h2>Links &#8211; aka Blogroll</h2>
<p>This functionality has been in WordPress since day one and for a good reason. WordPress started as a blogging platform and it made sense to have a heady feature to share other blogs you read. However, since WordPress was shifting more and more into CMS grounds this feature was kind of pointless. On my 5 years of developing WordPress themes professionally, I&#8217;ve used them once or twice in a site. That is enough for me to take the feature out of of WordPress and turn it into a plugin instead.</p>
<p>And this is what really happend in <a target="_blank" title="WordPress 3.5 Change Log" href="http://codex.wordpress.org/Version_3.5#Links">WordPress 3.5</a>.</p>
<h2>AIM, Yahoo IM, Jabber / Google Talk on Profile page</h2>
<p>Seems like these fields are there just to remind us of what used to trend back then in the instant messaging scene. I&#8217;ve never made use of those fields in my experience and on several occasions I&#8217;ve even needed to get rid of them. I now see themes around that deactivate them in  the theme functions. I guess I said enough, so please kiss the goodbye.</p>
<p>If you want to get rid of them yourself, <a target="_blank" title="Remove AIM, Yahoo, and Jabber Fields from the WordPress Profile Page" href="http://wpmu.org/remove-aim-yahoo-and-jabber-fields-from-the-wordpress-profile-page/"> here it is how it&#8217;s done</a>.</p>
<h2>Press This</h2>
<p>They say Press This is:</p>
<blockquote><p>&#8230;bookmarklet: a little app that runs in your browser and lets you grab bits of the web.</p></blockquote>
<p>You drag it into the Bookmarks toolbar &#8230; but wait, I don&#8217;t even have Bookmarks toolbar active on my browser. Thus, I find this totally useless and I&#8217;d want to see it out of WordPress core. I&#8217;d be more than happy to hear from someone that makes use of them.</p>
<h2>Turbo</h2>
<p>This used to be some Google powered optimization to the browser or the system where the browser was installed. It has been removed since WordPress 3.0, but it is in this list ofjust because I compiled it before that version. We&#8217;re good here.</p>
<p>Here goes my list. Please share with me what you want to see out of WordPress or what you used to want to see removed in the past. Thanks for your time.</p>
<img src="http://feeds.feedburner.com/~r/wplancer/~4/6XqE9DE3-EA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://wplancer.com/what-i-would-take-out-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://wplancer.com/what-i-would-take-out-of-wordpress/</feedburner:origLink></item>
		<item>
		<title>Your job is to put yourself out of work</title>
		<link>http://feedproxy.google.com/~r/wplancer/~3/vgligvV-bPE/</link>
		<comments>http://wplancer.com/your-job-is-to-put-yourself-out-of-work/#comments</comments>
		<pubDate>Wed, 29 Aug 2012 19:58:31 +0000</pubDate>
		<dc:creator>Baki Goxhaj</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Editor's Picks]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://banago.net/wplancer/?p=1176</guid>
		<description><![CDATA[Long time, no write &#8211; I know. I almost ready to blast you with great posts, so stay around for a bit longer. To get to the post of today, I came across a very interesting article on blogoverflow.com, the programmers community blog of StackExchange, titled 20 controversial programming opinions. One opinion really resonated with the way I feel and I was also surprised to know this makes you more valuable to your employer. So, I am sharing this with you below, but don&#8217;t neglect to check out the whole article &#8211; it&#8217;s a great read. Your job is to ...]]></description>
				<content:encoded><![CDATA[<p>Long time, no write &#8211; I know. I almost ready to blast you with great posts, so stay around for a bit longer.</p>
<p>To get to the post of today, I came across a very interesting article on blogoverflow.com, the programmers community blog of StackExchange, titled <a href="http://programmers.blogoverflow.com/2012/08/20-controversial-programming-opinions/">20 controversial programming opinions</a>. One opinion really resonated with the way I feel and I was also surprised to know this makes you more valuable to your employer. So, I am sharing this with you below, but don&#8217;t neglect to check out the whole article &#8211; it&#8217;s a great read.</p>
<blockquote><p><strong>Your job is to put yourself out of work.</strong><br />
When you’re writing software for your employer, any software that you create is to be written in such a way that it can be picked up by any developer and understood with a minimal amount of effort. It is well designed, clearly and consistently written, formatted cleanly, documented where it needs to be, builds daily as expected, checked into the repository, and appropriately versioned. If you get hit by a bus, laid off, fired, or walk off the job, your employer should be able to replace you on a moment’s notice, and the next guy could step into your role, pick up your code and be up and running within a week tops. If he or she can’t do that, then you’ve failed miserably. Interestingly, I’ve found that having that goal has made me more valuable to my employers. The more I strive to be disposable, the more valuable I become to them.</p>
</blockquote>
<img src="http://feeds.feedburner.com/~r/wplancer/~4/vgligvV-bPE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://wplancer.com/your-job-is-to-put-yourself-out-of-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://wplancer.com/your-job-is-to-put-yourself-out-of-work/</feedburner:origLink></item>
		<item>
		<title>The Importance of Choosing the Right WordPress Theme</title>
		<link>http://feedproxy.google.com/~r/wplancer/~3/oJkkOApCx5Y/</link>
		<comments>http://wplancer.com/the-importance-of-choosing-the-right-wordpress-theme/#comments</comments>
		<pubDate>Sun, 22 May 2011 17:30:31 +0000</pubDate>
		<dc:creator>Baki Goxhaj</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[WordPress Theme]]></category>

		<guid isPermaLink="false">http://www.wplancer.com/?p=1071</guid>
		<description><![CDATA[Choosing a WordPress theme can be a lot of fun as it allows you to personalise your website or blog and make it your own. However, ultimately, it can have a significant impact upon your online project, whatever it might be.]]></description>
				<content:encoded><![CDATA[<p>Choosing a WordPress theme can be a lot of fun as it allows you to personalise your website or blog and make it your own. However, ultimately, it can have a significant impact upon your online project, whatever it might be.</p>
<p>Many professional sites spend a great deal of time and money on designing the way their site will look. Websites such a www.apple.com, www.msn.com or <a title="www.o2.co.uk" href="http://www.o2.co.uk/broadband">www.o2.co.uk</a> have been designed to attract visitors and provide them with an interesting interface for the products and services which they have to offer.</p>
<p>The advantage of WordPress is that it allows anyone to set up their own blog or site, without needing to have extensive knowledge of how website design works. Although there is a standard format to these sites, there are also a number of customisable themes, many of which can be free to use. This allows you to tailor the look of your pages to match the purpose of your site or blog.</p>
<p>Although this often be done in just a few clicks, there are a number of important things to bear in mind when choosing which WordPress theme to use. It might sound obvious, but you will want to choose a think which fits with your chosen subject matter. A blog about baking cakes, for example, may not wish to choose dull, plain colour scheme, or a theme that features unappetizing images. A well chosen theme should give an immediate idea of what your blog might be focused on.</p>
<p>Secondly, you should think about the impact that your chosen theme will have upon your content. Will it change the layout of your page, or highlight certain areas of your work? If a theme will cause such alterations, they should be to the benefit of your site, rather causing and aspects of the page to go unnoticed, or become unclear.</p>
<p>Furthermore, you will also want to consider how far your chosen theme is able to be customise. Will it be able to accommodate your future developments? In evaluating each of these points, you should find that you are able to find a WordPress theme to suit your individual purpose and benefit your site as a whole.</p>
<img src="http://feeds.feedburner.com/~r/wplancer/~4/oJkkOApCx5Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://wplancer.com/the-importance-of-choosing-the-right-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://wplancer.com/the-importance-of-choosing-the-right-wordpress-theme/</feedburner:origLink></item>
		<item>
		<title>Easy PHP II: Variables</title>
		<link>http://feedproxy.google.com/~r/wplancer/~3/xD2O4WHm7wk/</link>
		<comments>http://wplancer.com/easy-php-ii-variables/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 21:58:50 +0000</pubDate>
		<dc:creator>Baki Goxhaj</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Editor's Picks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.wplancer.com/?p=986</guid>
		<description><![CDATA[In the previous <a title="PHP Introductin" href="http://www.wplancer.com/easy-php-i-introduction/">introductory PHP tutorial</a> we talked about what PHP looks like and in what kind of environment it runs. To sum up, we said that we write PHP code between tags that look like this: “<em>&#60;?php … ?&#62;</em>” and we end every command line must and in semicolon (<em>;</em>). We use “<em>echo</em>” or “<em>print</em>” in order for PHP to show things to us.]]></description>
				<content:encoded><![CDATA[<p>In the previous <a title="PHP Introductin" href="http://www.wplancer.com/easy-php-i-introduction/">introductory PHP tutorial</a> we talked about what PHP looks like and in what kind of environment it runs. To sum up, we said that we write PHP code between tags that look like this: “<em>&lt;?php … ?&gt;</em>” and we end every command line must and in semicolon (<em>;</em>). We use “<em>echo</em>” or “<em>print</em>” in order for PHP to show things to us. We also said that we need to have Apache server, PHP and MySQL installed in our computer or server so that PHP can run and we concluded that using a ready-made package like XAMPP, WAMP, or MAMP to achieve that would be optimal. Today we are going to learn about PHP variables, their kinds and use.</p>
<h3>What are Variables</h3>
<p>Here is what a variable looks like:</p>
<p><code></p>
<p>&lt;?php</p>
<p>// Our first variable</p>
<p>$cool_variable = 'This s a really cool variable';</p>
<p>?&gt;<br />
</code></p>
<p>Variables are used to hold some value or data for a certain time so that you can use it when you need it later in your code. Variables start with a dollar sign ($). A variable name must start with a letter or an underscore &#8220;_&#8221; . A variable name can only contain alpha-numeric characters and underscores (a-z, A-Z, 0-9, and _ ) and should not contain spaces. When a variable name is made of more than one word, it can be separated with an underscore ($cool_variable), or written in camel case ($coolVariable). Variables can hold data of different types.</p>
<p><strong>PHP Variables Data Types</strong></p>
<p>There are four PHP variables data types. Let&#8217;s deduce them by example:</p>
<p>{code type=php}</p>
<p>&lt;?php</p>
<p>$first_type = &#8216;This a cool text variable&#8217;; // Just text.</p>
<p>$second_type = 123; // Just a number – note the lack of quotes.</p>
<p>$third_type = 1.23; // Decimal number – note the lack of quotes.</p>
<p>$fourth_type = &#8216; &#8216;; // Just empty &#8211; cool, isn&#8217;t it.</p>
<p>?&gt;</p>
<p>{/code}</p>
<p>As you can see in above examples, declaring any type of variable is very easy. Every type has a name and they are respectively called: 1. <strong>String</strong>, 2. <strong>Integer</strong>, 3. <strong>Float</strong>, 4. <strong>Boolean</strong>. We don&#8217;t need to tell PHP which data type is variable holding; PHP evaluates the data when you assign it to the variable and then stores it as the appropriate type. Let&#8217;s talk about them in detail.</p>
<ul>
<li><strong>String: </strong>A series of characters, otherwise called text. There is no practical limit on the length of a string or text. A string must be written between double or single quotes, otherwise PHP will produce an error.</li>
<li><strong>Integer</strong>: A whole number (no fractions), such as –43, 0, 1, 27, or 5438. Integer numbers should not be wrapped with quotes, otherwise they will be considered as a string, not an integer i.e. text and not number.</li>
<li><strong>Float</strong>: A number (usually not a whole number) that includes decimal places, such as 5.24 or 123.456789. This is often called a real number or a float. A float should not be wrapped with quotes too.</li>
<li><strong>Boolean</strong>: A TRUE or FALSE value. Boolean data types represent two possible states — TRUE or FALSE. A FALSE boolean is declared in several ways &#8211; at the example above we saw only one of them. Here is the whole list:
<ul>
<li>The string <em>FALSE</em> (can be upper- or lowercase)</li>
<li>The integer 0</li>
<li>The float 0.0</li>
<li>An empty string (as in the example above)</li>
<li>The one-character string &#8217;0&#8242;</li>
<li>The constant NULL</li>
</ul>
<p>On the other hand, any other values in a Boolean variable are considered TRUE. If you echo a Boolean variable, the value FALSE displays as a blank string; the value TRUE echoes as a 1.</li>
</ul>
<p><strong>Assigning data to variables</strong></p>
<p>The equals sign we used in the above statements is called the <strong><em>assignment operator</em></strong>, as it is used to assign values to variables. There are a ton other <strong><em>PHP operators</em></strong> that we need to know in order to be successful PHP programmers and we will talk about them in our next tutorial <em>PHP Operators</em>, so stay tuned.</p>
<p><strong>Further Readings:</strong></p>
<ol>
<li>Understanding PHP Data Types: <a href="http://eu.dummies.com/WileyCDA/how-to/content/understanding-php-data-types.html#ixzz0eONIuWQ5">http://eu.dummies.com/WileyCDA/how-to/content/understanding-php-data-types.html</a></li>
<li>PHP Variables: <a href="http://www.w3schools.com/PHP/php_variables.asp">http://www.w3schools.com/PHP/php_variables.asp</a></li>
<li>What is a Variable: <a href="http://www.homeandlearn.co.uk/php/php2p1.html">http://www.homeandlearn.co.uk/php/php2p1.html</a></li>
<li>Learn PHP from Scratch: <a href="http://net.tutsplus.com/tutorials/php/learn-php-from-scratch-a-training-regimen/">http://net.tutsplus.com/tutorials/php/learn-php-from-scratch-a-training-regimen/</a></li>
</ol>
<img src="http://feeds.feedburner.com/~r/wplancer/~4/xD2O4WHm7wk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://wplancer.com/easy-php-ii-variables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://wplancer.com/easy-php-ii-variables/</feedburner:origLink></item>
		<item>
		<title>How to Limit Content in WordPress</title>
		<link>http://feedproxy.google.com/~r/wplancer/~3/Z-4LYfXaN4I/</link>
		<comments>http://wplancer.com/how-to-limit-content-in-wordpress/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 14:31:14 +0000</pubDate>
		<dc:creator>Baki Goxhaj</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Editor's Picks]]></category>
		<category><![CDATA[Limit Content]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.wplancer.com/?p=905</guid>
		<description><![CDATA[This is an old article describing old-fashioned ways of limiting content. I&#8217;m publishing a new article on this topic very soon so make sure you subscribe below. Have you seen those cool magazine style WordPress themes around this days? They are just cool. You might have noticed that they sometimes show a few words of the post, this is for sure not the default WordPress excerpt showing that because the default excerpt length is set to 55 words and manually excerpting every post would be a great time consumer. So, what are this guys putting together to get that cool ...]]></description>
				<content:encoded><![CDATA[<div class="alert red">This is an old article describing old-fashioned ways of limiting content. I&#8217;m publishing a new article on this topic very soon so make sure you subscribe below.</div>
<p>Have you seen those cool magazine style WordPress themes around this days? They are just cool. You might have noticed that they sometimes show a few words of the post, this is for sure not the default <a title="WordPress Excerpt" href="http://codex.wordpress.org/Template_Tags/the_excerpt">WordPress excerpt</a> showing that because the default excerpt length is set to 55 words and manually excerpting every post would be a great time consumer. So, what are this guys putting together to get that cool effect on their sites by controlling the length of the content? Well, as a <a title="WordPress Freelancer" href="http://www.wplancer.com/wordpress-freelance-services/">WordPress freelancer</a>, I have been needing that feature myself and today I&#8217;m going to share with you how to have that feature on your site.</p>
<p>There are three different approaches to limit your excerpt or content in WordPress that you must know:</p>
<h2>1. WordPress&#8217;s Approach</h2>
<p>WordPress developers have provided us lately with a tool to limit the excerpt. I do not use it myself as I&#8217;m more conformable with another approach as I find this a little limited. To change excerpt length using the default WordPress excerpt limit approach you have to use the <a title="Plugin API/Filter Reference/excerpt length" href="http://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_length">excerpt_length</a> filter and add the following code to <em>functions.php</em> file in your theme:</p>
<pre class="code">function new_excerpt_length($length) {
      return 20;
 }
add_filter('excerpt_length', 'new_excerpt_length');</pre>
<p>Every time you will use <em>the_excerpt();</em> on your code it will output an 20-word text string for you. Right now you&#8217;ve got a question, don&#8217;t you? I know, I had it too. The question is: What if I want to use the 20-word excerpt in some places on my theme, but still be able to use the 55-word one? Or just have two or three different-length exerts to use on my theme? Well, if that is the case, the default approach is not for you, so continue reading.</p>
<h2>2. The StudioPress Approach</h2>
<p>I don&#8217;t really know who came up with this approach originally, but I know that the guys over at <a title="StudioPress" href="http://www.studiopress.com">StudioPress</a> use it on their themes. This function is called <em>the_content_limit().</em> This is how the code that will go into the <em>functions.php</em> file looks like &#8211; lengthy huh?</p>
<pre class="code">function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') { 
$content = get_the_content($more_link_text, $stripteaser, $more_file); 
$content = apply_filters('the_content', $content); $content = str_replace(']]&gt;', ']]&gt;', $content); 
$content = strip_tags($content); 
if (strlen($_GET['p']) &gt; 0) { 
echo ""; echo $content; echo " "."Read More →"; echo ""; 
} 
else if ((strlen($content)&gt;$max_char) &amp;&amp; ($espacio = strpos($content, " ", $max_char ))) { 
$content = substr($content, 0, $espacio); $content = $content; echo ""; 
echo $content; 
echo "..."; 
echo "".$more_link_text."
"; echo ""; 
} else { 
echo ""; echo $content; echo " 
"."Read More →
"; echo ""; 
} }</pre>
<p>Now we have to call that function because, off course, we are not going to use the default <em>the_excerpt();</em> function. Here:</p>
<pre class="code">the_content_limit(20, "[Read more]");</pre>
<p>Pretty simple to use and offers you the possibility to auto-generate a <em>Read More &#8230; </em>of you choice.</p>
<h2>C.bavota&#8217;s Apprach</h2>
<p>C.bacota &#8211; I don&#8217;t know his real name &#8211; has produced a couple of great code snippets to limit the content for both <em>the_content()</em> and <em>the_excerpt()</em>. As you may already know, <em>the_excerpt()</em> gets 55 words from <em>the_content()</em> but get rids of all the HTML tags on it, be it links, images or whatever. So, this guy produced a script that allows you to choose to use the text-only version or the html-rich version to limitedly display. I find this functions really cool and easy to use and I have been using them ever since they were produced. This is how the block of code that goes into <em>functions.php</em> looks like:</p>
<pre class="code">// Limit the content to certain number of words.
 function excerpt($num) {
 $limit = $num+1;
 $excerpt = explode(' ', get_the_excerpt(), $limit);
 array_pop($excerpt);
 $excerpt = implode(" ",$excerpt)."...";
 echo $excerpt;
 }
 // Limit the content to certain number of words.
 function content($num) {
 $limit = $num+1;
 $content = explode(' ', get_the_content(), $limit);
 array_pop($content);
 $content = implode(" ",$content)."...";
 echo $content;
}</pre>
<p>The above code is quite cool, but has two limitation: The first block of code, will not allow you to have a custom excerpt longer than 55 words, the same as <em>the_excerpt()</em> does, and the second one will bump image into your shorten content if you are using images in the original one. However, Mr. C.Basoda eventually thought about his and <a title="Limit Content or Excerpt" href="http://bavotasan.com/tutorials/limiting-the-number-of-words-in-your-excerpt-or-content-in-wordpress/">produced later a revised version</a> of the code that will allow you to use more than 55 words and not get images on the wrong place there. Here is the revised code:</p>
<pre class="code">function excerpt($limit) {
 $excerpt = explode(' ', get_the_excerpt(), $limit);
 if (count($excerpt)&gt;=$limit) {
 array_pop($excerpt);
 $excerpt = implode(" ",$excerpt).'...';
 } else {
 $excerpt = implode(" ",$excerpt);
 }
 $excerpt = preg_replace('`[[^]]*]`','',$excerpt);
 return $excerpt;
 }</pre>
<pre class="code">function content($limit) {
 $content = explode(' ', get_the_content(), $limit);
 if (count($content)&gt;=$limit) {
 array_pop($content);
 $content = implode(" ",$content).'...';
 } else {
 $content = implode(" ",$content);
 }
 $content = preg_replace('/[.+]/','', $content);
 $content = apply_filters('the_content', $content);
 $content = str_replace(']]&gt;', ']]&amp;gt;', $content);
 return $content;
 }</pre>
<p>And finally here is how you use this fantastic piece of code:</p>
<pre class="code">excerpt('20');

// or
content('20');</pre>
<h2>Final Thoughts</h2>
<p>We are finally done.  I would also like to make clear that the approaches I presented so far are not necessary all the existing or possible ways to achieve content limitation, however this is what I know and what I thought was of value to share with you. Thanks for reading.</p>
<img src="http://feeds.feedburner.com/~r/wplancer/~4/Z-4LYfXaN4I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://wplancer.com/how-to-limit-content-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		<feedburner:origLink>http://wplancer.com/how-to-limit-content-in-wordpress/</feedburner:origLink></item>
	</channel>
</rss>
