<?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>Banhawi &#187; custom wordpress function</title>
	<atom:link href="http://banhawi.com/tag/custom-wordpress-function/feed/" rel="self" type="application/rss+xml" />
	<link>http://banhawi.com</link>
	<description>Web Design and Development News and Tutorials</description>
	<lastBuildDate>Sat, 07 Jan 2012 03:52:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>[Custom Function] Get Posts by Author ID</title>
		<link>http://banhawi.com/2011/06/custom-function-get-posts-by-author-id/</link>
		<comments>http://banhawi.com/2011/06/custom-function-get-posts-by-author-id/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 23:13:19 +0000</pubDate>
		<dc:creator>Banhawi</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[author functions]]></category>
		<category><![CDATA[custom wordpress function]]></category>
		<category><![CDATA[get author posts]]></category>
		<category><![CDATA[get posts by author id]]></category>

		<guid isPermaLink="false">http://banhawi.com/?p=226</guid>
		<description><![CDATA[If you are trying to get posts for a certain author/user , unfortunately there is no function offered by wordpress to do this so i wrote this function to help you do this this function takes two parameters $id which is author id $num which is number of posts you want to query and it [...]]]></description>
			<content:encoded><![CDATA[<p>If you are trying to get posts for a certain author/user , unfortunately there is no function offered by wordpress to do this so i wrote this function to help you do this<br />
<span id="more-226"></span></p>
<pre class="brush: php; title: ; notranslate">
function get_posts_by_author($id,$num) {
	global $wpdb;
	$posts = $wpdb-&gt;get_results(&quot;SELECT * from $wpdb-&gt;posts WHERE post_type = 'post' AND post_status = 'publish' AND post_author = $id LIMIT 0,$num&quot;, ARRAY_A);
	return $posts;
}
</pre>
<p>this function takes two parameters<br />
$id which is author id<br />
$num which is number of posts you want to query </p>
<p>and it returns your posts in an array , so for example if you want to get the title of the first returned post you have to write this </p>
<pre class="brush: php; title: ; notranslate">
$posts[0]['post_title']
</pre>
]]></content:encoded>
			<wfw:commentRss>http://banhawi.com/2011/06/custom-function-get-posts-by-author-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Custom Function] Get Category Link by Name</title>
		<link>http://banhawi.com/2010/02/custom-function-get-category-link-by-name/</link>
		<comments>http://banhawi.com/2010/02/custom-function-get-category-link-by-name/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 00:30:34 +0000</pubDate>
		<dc:creator>Banhawi</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[custom wordpress function]]></category>
		<category><![CDATA[get_cat_ID]]></category>
		<category><![CDATA[get_category_link]]></category>
		<category><![CDATA[get_category_link_byname]]></category>
		<category><![CDATA[wordpress function]]></category>
		<category><![CDATA[wordpress function reference]]></category>
		<category><![CDATA[wordpress tutorial]]></category>

		<guid isPermaLink="false">http://banhawi.com/?p=180</guid>
		<description><![CDATA[I was working on a theme and i faced that problem , i wanted to get dynamically the category link using category names and there&#8217;s no function in wordpress to do that , so i&#8217;ve wrote a simple function that does what i need . I&#8217;ve used get_cat_ID function to get category id using name [...]]]></description>
			<content:encoded><![CDATA[<p>I was working on a theme and i faced that problem , i wanted to get dynamically the category link using category names and there&#8217;s no function in wordpress to do that , so i&#8217;ve wrote a simple function that does what i need .<br />
I&#8217;ve used get_cat_ID function to get category id using name , then get_category_link function to get category link using category id , very simple .<br />
<span id="more-180"></span></p>
<pre class="brush: php; title: ; notranslate">
function get_category_link_byname($name) {
	$id = get_cat_ID($name);
	$link = get_category_link( $id );
	echo $link;
}
</pre>
<p>use this function as follows ,</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php function get_category_link_byname('categoryname'); ?&gt;
</pre>
<p>and that&#8217;s it , hope you find it useful .</p>
]]></content:encoded>
			<wfw:commentRss>http://banhawi.com/2010/02/custom-function-get-category-link-by-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

