<?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>Tech Hive &#124; Front End Development, WordPress and Drupal Developer&#187; Tutorials</title>
	<atom:link href="http://tech-hive.com/topic/wordpress/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech-hive.com</link>
	<description>Mae Paulino &#124; Web Designer and Front End Developer</description>
	<lastBuildDate>Mon, 01 Aug 2011 05:29:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Presenting videos using WordPress</title>
		<link>http://tech-hive.com/tutorials/presenting-videos-using-wordpress-20080909/</link>
		<comments>http://tech-hive.com/tutorials/presenting-videos-using-wordpress-20080909/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 08:54:56 +0000</pubDate>
		<dc:creator>Mae</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[sample codes]]></category>

		<guid isPermaLink="false">http://tech-hive.com/?p=23</guid>
		<description><![CDATA[And without using a plugin. I thought of creating this post when I was on my way home from the recently concluded WordCamp Philippines. There was a woman who was in Karla Redor&#8216;s talk who asked on how she can host the video in her own blog and use WordPress to file it for her. She can use a plugin that will let her upload the videos in her blog or do it the &#8220;harder&#8221; way. Something that I&#8217;m very fond of doing. Seriously, I&#8217;m the type of person who would only resort to using plugins if: I&#8217;m lazy at the time to think of another way without using a plugin My head is aching and I&#8217;m getting frustrated because it just won&#8217;t follow what I&#8217;m telling it. The reason is because I am not a developer and it&#8217;s really hard to be dependent on a plugin specially if that &#8230; <a href="http://tech-hive.com/tutorials/presenting-videos-using-wordpress-20080909/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>And without using a plugin.</p>
<p>I thought of creating this post when I was on my way home from the recently concluded <a href="http://www.tech-hive.com/updates/wordcamp-philippines-2008/">WordCamp Philippines</a>. There was a woman who was in <a href="http://rockersworld.com">Karla Redor</a>&#8216;s talk who asked on how she can host the video in her own blog and use WordPress to file it for her. She can use a <a href="http://lorelle.wordpress.com/2007/02/17/video-music-podcasts-audio-and-multimedia-wordpress-plugins/">plugin that will let her upload the videos in her blog</a> or do it the &ldquo;harder&rdquo; way. Something that I&#8217;m very fond of doing.</p>
<p>Seriously, I&#8217;m the type of person who would only resort to using plugins if:</p>
<ol>
<li>I&#8217;m lazy at the time to think of another way without using a plugin</li>
<li>My head is aching and I&#8217;m getting frustrated because it just won&#8217;t follow what I&#8217;m telling it.</li>
</ol>
<p>The reason is because I am <em>not</em> a developer and it&#8217;s really hard to be dependent on a plugin specially if that plugin is what&#8217;s keeping your blog alive. Also, if the developer of the plugin suddenly stops supporting the plugin and no one else is willing to take it up from there. What&#8217;s worse is if it&#8217;s not compatible with the newer version of WordPress. Then I will be lost.</p>
<p>So anyway, on to the &ldquo;how&rdquo;.</p>
<ol>
<li>Convert you video to a <code>.swf</code> file, you can use <a href="http://heywatch.com">Hey!Watch</a>, it has a fee though but considering how it will make your life easier, I think it&#8217;s worth it. Besides it will convert a video for $0.10 so I don&#8217;t think that&#8217;s too much.</li>
<li>Next in your code (you&#8217;d want to add this in your <code>single.php</code> page), call for the video custom field (which you&#8217;ll be adding later on). Note that this should be <strong>within</strong> <a href="http://codex.wordpress.org/The_Loop">the loop</a>. <small>Also, note that the snippet is taken from a <a href="http://wordpress.org/support/topic/196935">WordPress support forum</a> and changed to suit the topic.</small>
<pre><code>&lt;?php $video = get_post_meta($post->ID, 'video', true); ?&gt;
&lt;?php if (!empty($video)) {;?&gt;
&lt;object type="application/x-shockwave-flash" data="&lt;?php echo $video; ?&gt;" width="400" height="300"&gt;
&lt;param name="movie" value="&lt;?php echo $video; ?&gt;" /&gt;
&lt;/object&gt;
&lt;?php }; ?&gt;</code></pre>
<p>What does this mean? The first line sets the <code>$video</code> variable to the value of the <code>video</code> key (of the custom field). Next it checks if the <code>video</code> has a value attached to it (in that particular post). If it does, it inserts the value in the <code>data</code> and <code>value</code> properties of <code>object</code> and <code>param</code>. If the <code>video</code> doesn&#8217;t have any values then it won&#8217;t display anything.</p>
<p>This way, it saves you the time to copy and paste the entire code for the video. Now if you want the lazier way, you will have to adhere to some restrictions. For example, you can set the value of <code>data</code> and <code>value</code> to:</p>
<p><code>&lt;?php bloginfo('url') ?&gt;/videos/&lt;?php echo $video; ?&gt; </code></p>
<p>This means that you will only be able to upload videos within the videos folder within your root. That way, you&#8217;ll only put the filename of the video in the custom field value.
</li>
<li>Once you&#8217;ve uploaded your video to your server (within the specified folder of course), go to the admin panel of your blog and then create a post (or a page) in your custom fields area, do what&#8217;s illustrated in the image below:
<p><a href="http://tech-hive.com/wp-content/uploads/2008/09/picture-6.png"><img src="http://tech-hive.com/wp-content/uploads/2008/09/picture-6.png" alt="" title="Custom Fields" width="500" height="200" class="alignnone size-full wp-image-86" /></a></p>
<p>As you can see, I decided that I want to have another folder within my videos folder. My videos will be categorized according to shows, so the value of my video key is unang_hirit/episode_100.swf. Once published, the post&#8217;s HTML will appear like this:</p>
<pre><code>&lt;object type="application/x-shockwave-flash" data="http://domain.com/videos/unang_hirit/episode_100.swf" width="400" height="300"&gt;
  &lt;param name="movie" value="http://domain.com/videos/unang_hirit/episode_100.swf" /&gt;
&lt;/object&gt;</code></pre>
</li>
</ol>
<h3>Featured Video</h3>
<p>If for some reason, you want to create a section that is called the &ldquo;Featured Video&rdquo; section on your sidebar, you can call it by using the following lines of code:</p>
<pre><code>&lt;?php query_posts('category_name=Featured Videos&#038;showposts=1'); ?&gt;
  &lt;?php while (have_posts()) : the_post(); ?&gt;
    &lt;?php $video = get_post_meta($post->ID, 'video', true); ?&gt;
    &lt;?php if (!empty($video)) {;?&gt;
    &lt;object type="application/x-shockwave-flash" data="&lt;?php echo $video; ?&gt;" width="400" height="300"&gt;
    &lt;param name="movie" value="&lt;?php echo $video; ?&gt;" /&gt;
    &lt;/object&gt;
    &lt;?php }; ?&gt;
  &lt;?php endwhile(); ?&gt;</code></pre>
<p>If you&#8217;d notice, we recycled the code from above. The only difference is the <code>query_posts</code> tag before the loop. What the <code>query_posts</code> tag does is that it takes a single, recently added post (<code>showposts=1</code>) from a category called &ldquo;Featured Videos&rdquo;. And it&#8217;s the same business as what was discussed above.</p>
<p><strong>Further reading:</strong></p>
<ul>
<li><a href="http://codex.wordpress.org/Using_Custom_Fields">WordPress Codex: Using Custom Fields</a></li>
<li><a href="http://www.alistapart.com/articles/flashsatay">A List Apart: Embedding Flash While Supporting Standards</a></li>
<li><a href="http://codex.wordpress.org/Template_Tags/query_posts">WordPress Codex: Template Tags: query_posts</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tech-hive.com/tutorials/presenting-videos-using-wordpress-20080909/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Appending the title of the post in &#8220;Read more&#8221; links for WordPress</title>
		<link>http://tech-hive.com/tutorials/appending-the-title-of-the-post-in-read-more-links-for-wordpress-20080428/</link>
		<comments>http://tech-hive.com/tutorials/appending-the-title-of-the-post-in-read-more-links-for-wordpress-20080428/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 08:52:38 +0000</pubDate>
		<dc:creator>Mae</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[sample codes]]></category>
		<category><![CDATA[usability tip]]></category>

		<guid isPermaLink="false">http://tech-hive.com/?p=18</guid>
		<description><![CDATA[One of the guidelines in usability is that you should provide only one way that will lead them to a certain action. For example, if someone sees 2 option buttons, chances are that they might think that each option button does separate tasks when in fact their functions are the same. Also, we have to make sure that the links are descriptive enough and if not, then we should provide a title for the link so when a user hovers over it then they&#8217;ll know where the link will take them. On a similar note, accessibility advocates encourages people to use unique name for every link that we use on a page (kinda like what I was saying before only have a different reason), meaning countless &#8220;Read more of this entry&#8221; is not really the best practice because you&#8217;re using the same text over and over and these texts are &#8230; <a href="http://tech-hive.com/tutorials/appending-the-title-of-the-post-in-read-more-links-for-wordpress-20080428/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>One of the guidelines in usability is that you should <strong>provide only one way that will lead them to a certain action</strong>. For example, if someone sees 2 option buttons, chances are that they might think that each option button does separate tasks when in fact their functions are the same. Also, we have to make sure that the links are descriptive enough and if not, then we should provide a title for the link so when a user hovers over it then they&#8217;ll know where the link will take them. </p>
<p>On a similar note, accessibility advocates encourages people to use unique name for every link that we use on a page (kinda like what I was saying before only have a different reason), meaning countless &ldquo;Read more of this entry&rdquo; is not really the best practice because you&#8217;re using the same text over and over and these texts are leading the user to different pages.</p>
<p>I was looking for a way to add that in <code>&lt;?php the_content(); ?&gt;</code> tag in wordpress before but I couldn&#8217;t do it. What I did then was append the <code>the_title();</code> within <code>the_content();</code> so it looked like this &#8211;</p>
<p><code>&lt;?php the_content('Read more of ' . the_title() . ' &amp; raquo;' ?&gt;</code></p>
<p>The problem though is that it does echo the &ldquo;Read more of&rdquo; but the title is no where in sight! I was so ready to find a way to make it show by hacking away through function.php, thankfully I remembered to check <a href="http://codex.wordpress.org/Template_Tags/the_content" title="Wordpress Codex - Template Tags - the_content"><code>the_content</code> page in the codex first</a>.</p>
<p>What I should&#8217;ve done in the first place is to add parameters to the <code>the_title()</code> tag so it will show like this &#8211;</p>
<p><code>&lt;?php the_content('Read more of ' . the_title('', '', false)) ?&gt;</code></p>
<p>This follows the same parameter as the <code>the_title();</code> template tag.</p>
<blockquote>
<h3>Parameters</h3>
<p><strong>before </strong><br />
(string) Text to place before the title. Defaults to &#8221;.</p>
<p><strong>after </strong><br />
(string) Text to place after the title. Defaults to &#8221;.</p>
<p><strong>display </strong><br />
(Boolean) Display the title (TRUE) or return it for use in PHP (FALSE). Defaults to TRUE.
</p></blockquote>
<p>So you may use it like this:</p>
<p><code>&lt;?php the_content('Read more of ' . the_title('&#038;ldquo ;', '&#038;rdquo ; &#038;raquo ;', false)) ?&gt;</code></p>
<p>So it will echo as <em>Read more of &ldquo;Title of the Post&rdquo; &raquo;</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech-hive.com/tutorials/appending-the-title-of-the-post-in-read-more-links-for-wordpress-20080428/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When &#8216;is_home()&#8217; doesn&#8217;t work</title>
		<link>http://tech-hive.com/tutorials/when-is-home-doesnt-work-20080308/</link>
		<comments>http://tech-hive.com/tutorials/when-is-home-doesnt-work-20080308/#comments</comments>
		<pubDate>Sat, 08 Mar 2008 08:56:55 +0000</pubDate>
		<dc:creator>Mae</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[sample codes]]></category>
		<category><![CDATA[usability tip]]></category>

		<guid isPermaLink="false">http://tech-hive.com/?p=25</guid>
		<description><![CDATA[Note: This has been written a long time ago, some of the stuff here might not work anymore. I&#8217;d recommend using &#60;?php is_frontpage(); &#62; when using static frontpage instead. You can also visit the WordPress Codex for more information or contact me and I&#8217;ll try my best to help you. You hacked your WordPress homepage because you don&#8217;t intend to make a blog out of it and then all of a sudden the very useful conditional tag &#60;?php if(is_home()) ?&#62; no longer works. It happened to me twice and for that 2 occurrences, I couldn&#8217;t find a solution until a couple of days ago. I&#8217;m working on this project where I don&#8217;t need to show my posts anywhere aside from the category archive and single, not even in the homepage. What the client wants is that the home page should show all of the categories in the site, no matter &#8230; <a href="http://tech-hive.com/tutorials/when-is-home-doesnt-work-20080308/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="notice message">
<p>Note: This has been written a long time ago, some of the stuff here might not work anymore. I&#8217;d recommend using <code>&lt;?php is_frontpage(); &gt;</code> when using static frontpage instead. You can also visit the <a href="http://codex.wordpress.org/Main_Page">WordPress Codex</a> for more information or <a href="http://tech-hive.com/contact">contact me</a> and I&#8217;ll try my best to help you.</p>
</div>
<p>You hacked your WordPress homepage because you don&#8217;t intend to make a blog out of it and then all of a sudden the very useful conditional tag <code>&lt;?php if(is_home()) ?&gt;</code> no longer works. It happened to me twice and for that 2 occurrences, I couldn&#8217;t find a solution until a couple of days ago.</p>
<p>I&#8217;m working on this project where I don&#8217;t need to show my posts anywhere aside from the category archive and single, not even in the homepage. What the client wants is that the home page should show all of the categories in the site, no matter if it&#8217;s empty or not and a certain page content must be pulled into it. Because I&#8217;m lazy in creating a page template just for that and assigning that page as the home page, I modified the main index template instead.</p>
<p>Those things are actually easy to do. All I have to do is to write this within the main index template:</p>
<p><code>&lt;?php wp_list_categories('order_by=name&#038;hide_empty=0&#038;title_li='); ?&gt;</code></p>
<p>so it&#8217;ll show all of the categories ordered by the category name whether it has posts or not. And for the page to be pulled into the main index, <code>query_post</code> is the answer:</p>
<p><code>&lt;?php query_posts('page_id=ID'); while (have_posts()) : the_post(); ?&gt;<br />
&lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;<br />
&lt;?php the_content(); endwhile; ?&gt;</code></p>
<p>so it&#8217;ll show the title and the contents of the page ID.</p>
<p>It worked just as expected and I was so proud of myself until the client asked that the sidebar for the home page be different from the rest of the site. That&#8217;s when I knew that the <code>is_home()</code> doesn&#8217;t work.				</p>
<p>I searched high and low for in the codex and support forum but couldn&#8217;t find anything. I can&#8217;t tell the client that I can&#8217;t fix this so I tried my hunch if it works. I&#8217;m not the type who is a big fan of plugins because I&#8217;m afraid that if the site rely heavily on plugins and and if and when that certain plugins&#8217;s developer goes AWOL, the site might go berserk due to incompatibility and all I could do was search again for a plugin that could replace it.</p>
<p>I thought that the home page is being treated by wordpress as if it&#8217;s a <em>page</em> because I did pull the contents of a page into it. Turns out that I was right!</p>
<p>When I put <code>&lt;?php if(is_page('ID')) { ?&gt;</code> in the sidebar, it worked just as I wanted it to.</p>
<p>So now, I realized that once you&#8217;ve changed the content of your main index template, know that you are also taking out it being your &#8220;home&#8221; because it will start acting like a page (if you pulled a page into it).</p>
]]></content:encoded>
			<wfw:commentRss>http://tech-hive.com/tutorials/when-is-home-doesnt-work-20080308/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

