<?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>WpFunc &#187; functions.php</title>
	<atom:link href="http://wpfunc.com/tag/functions-php/feed" rel="self" type="application/rss+xml" />
	<link>http://wpfunc.com</link>
	<description>Awesome, Quick, Simple WordPress Functions!</description>
	<lastBuildDate>Sun, 06 May 2012 02:21:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Paginating without any plugin</title>
		<link>http://wpfunc.com/wordpress/paginating-without-any-plugin.html</link>
		<comments>http://wpfunc.com/wordpress/paginating-without-any-plugin.html#comments</comments>
		<pubDate>Sun, 06 May 2012 02:20:36 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[pagination]]></category>
		<category><![CDATA[without plugin]]></category>

		<guid isPermaLink="false">http://wpfunc.com/?p=527</guid>
		<description><![CDATA[You can use that simple code for pagination&#8230; This is a built-in function for WordPress&#8230; Lets Begin&#8230; The Code; Add this code to your theme&#8217;s functions.php before the last ?> tag. Source: Here]]></description>
			<content:encoded><![CDATA[<p>You can use that simple code for pagination&#8230; This is a built-in function for WordPress&#8230; Lets Begin&#8230;<span id="more-527"></span></p>
<h3>The Code;</h3>
<p>Add this code to your theme&#8217;s <code>functions.php</code> before the last <code>?></code> tag. </p>
<pre class="brush: php; title: ; notranslate">
// get total number of pages
global $wp_query;
$total = $wp_query-&gt;max_num_pages;
// only bother with the rest if we have more than 1 page!
if ( $total &gt; 1 )  {
     // get the current page
     if ( !$current_page = get_query_var('paged') )
          $current_page = 1;
     // structure of “format” depends on whether we’re using pretty permalinks
     $format = empty( get_option('permalink_structure') ) ? '&amp;page=%#%' : 'page/%#%/';
     echo paginate_links(array(
          'base' =&gt; get_pagenum_link(1) . '%_%',
          'format' =&gt; $format,
          'current' =&gt; $current_page,
          'total' =&gt; $total,
          'mid_size' =&gt; 4,
          'type' =&gt; 'list'
     ));
}
</pre>
<p>Source: <a href="http://wp.smashingmagazine.com/2011/05/10/new-wordpress-power-tips-for-template-developers-and-consultants/" target="_blank">Here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/paginating-without-any-plugin.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Catch the First Image (Upgraded)</title>
		<link>http://wpfunc.com/wordpress/catch-the-first-image-upgraded.html</link>
		<comments>http://wpfunc.com/wordpress/catch-the-first-image-upgraded.html#comments</comments>
		<pubDate>Sat, 12 Nov 2011 00:42:34 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[catch the first image]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[custom field]]></category>
		<category><![CDATA[first image]]></category>
		<category><![CDATA[full]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[index.php]]></category>
		<category><![CDATA[latest]]></category>
		<category><![CDATA[single.php]]></category>
		<category><![CDATA[thumb]]></category>
		<category><![CDATA[thumbnail]]></category>
		<category><![CDATA[timthumb]]></category>
		<category><![CDATA[upgraded]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=509</guid>
		<description><![CDATA[Brian asked me here about Catch the First image function can be upgrade. I was coded this function for my Turkish blog for Home Page thumbs. If you set no image about post (not the wordpress post thumb feature, if you dont upload any image) this function get custom (default) image for this. Let&#8217;s Begin&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Brian asked me <a href="http://www.wpfunc.com/wordpress/catch-the-first-image.html/comment-page-1#comment-949" target="_blank">here</a> about <a href="http://www.wpfunc.com/wordpress/catch-the-first-image.html" title="Catch the First Image" target="_blank">Catch the First image function</a> can be upgrade. I was coded this function for my Turkish blog for Home Page thumbs. If you set no image about post (not the wordpress post thumb feature, if you dont upload any image) this function get custom (default) image for this. Let&#8217;s Begin&#8230;<span id="more-509"></span></p>
<h4>The Code;</h4>
<p>You will edit your theme&#8217;s <strong>functions.php</strong>. Because of this you should <strong>backup</strong> before. File&#8217;s path is <strong>/wp-content/themes/your-theme/functions.php</strong></p>
<pre class="brush: php; title: ; notranslate">// Get Image Attachments
function sa_get_image($postid=0, $size='thumbnail') { //it can be thumbnail or full
	if ($postid&lt;1)
	$postid = get_the_ID();
	$thumb = get_post_meta($postid, &quot;thumb&quot;, TRUE); // Declare the custom field for the image
	if ($thumb != null or $thumb != '') {
		echo $thumb;
	}
	elseif ($images = get_children(array( //If you upload an image function gets first image
		'post_parent' =&gt; $postid,
		'post_type' =&gt; 'attachment',
		'numberposts' =&gt; '1',
                'orderby' =&gt; 'menu_order',
                'order' =&gt; 'ASC', //If reverse use DESC
		'post_mime_type' =&gt; 'image', )))
		foreach($images as $image) {
			$thumbnail=wp_get_attachment_image_src($image-&gt;ID, $size);
			?&gt;
	&lt;?php echo $thumbnail[0]; ?&gt;
	&lt;?php }
		else { //If you don't upload or declare as thumb custom field func. gets custom (default) image
		echo get_bloginfo ( 'template_directory' ); //same as wp-content/themes/your-theme/
		echo '/images/image-pending.gif'; // Put this image into your themes images folder and set the path here
	}
}</pre>
<p>You can use this function with your several files like index.php, single.php or anything. </p>
<pre class="brush: php; title: ; notranslate">&lt;img src=&quot;&lt;?php sa_get_image($post-&gt;ID, 'thumbnail'); ?&gt;&quot; /&gt;</pre>
<p>If you set your thumbnail size 100*100 from wordpress you can get a thumbnail image where you want. Also you can use another function with that. You can style your image&#8217;s div or you can use timthumb.</p>
<h4>Without Timthumb;</h4>
<pre class="brush: php; title: ; notranslate">// Show Post Thumbnails
function sa_show_thumb_tim() {
?&gt;
&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&lt;img class=&quot;thumb&quot; width=&quot;100&quot; height&quot;100&quot; src=&quot;&lt;?php sa_get_image($post-&gt;ID, 'full'); ?&gt;&quot; alt=&quot;&lt;?php the_title(); ?&gt;&quot; /&gt;&lt;/a&gt;
&lt;?php
}</pre>
<p>You can use this like this directly. Because we coded function with <code>img</code> tag.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php sa_show_thumb(); ?&gt;</pre>
<h4>With Timthumb;</h4>
<pre class="brush: php; title: ; notranslate">// Show Post Thumbnails With TimThumb
function sa_show_thumb_tim() {
?&gt;
&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot;&gt;&lt;img class=&quot;thumb&quot; src=&quot;&lt;?php bloginfo('template_directory'); ?&gt;/timthumb.php?src=&lt;?php sa_get_image($post-&gt;ID, 'full'); ?&gt;&amp;amp;h=100&amp;amp;w=100&amp;amp;zc=1&quot; alt=&quot;&lt;?php the_title(); ?&gt;&quot; /&gt;&lt;/a&gt;
&lt;?php
}</pre>
<p>You can use this like this directly. Because we coded function with <code>img</code> tag and we add timthumb function. You can get the latest version of timhtumb <a href="http://code.google.com/p/timthumb/" target="_blank">here</a>. And you have to put <strong>timthumb.php</strong> into your theme&#8217;s folder.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php sa_show_thumb_tim(); ?&gt;</pre>
<p>Best Regards</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/catch-the-first-image-upgraded.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Show link with page names</title>
		<link>http://wpfunc.com/wordpress/show-link-with-page-names.html</link>
		<comments>http://wpfunc.com/wordpress/show-link-with-page-names.html#comments</comments>
		<pubDate>Thu, 10 Nov 2011 00:59:13 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[header]]></category>
		<category><![CDATA[link]]></category>
		<category><![CDATA[linkname]]></category>
		<category><![CDATA[target]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=504</guid>
		<description><![CDATA[You can show links with Pages names. That means target pages name. Let&#8217;s begin&#8230; The code Add this code into functions.php which file in your theme&#8217;s. After that you can use this shortcode with your posts. The Sample is here (Turkish) Click Simple isn&#8217;t it :)]]></description>
			<content:encoded><![CDATA[<p>You can show links with Pages names. That means target pages name. Let&#8217;s begin&#8230;<span id="more-504"></span></p>
<h3>The code</h3>
<pre class="brush: php; title: ; notranslate">//Show link with name
function link_ismi_getir($atts) { //Fonksiyon başlangıcı :)
	extract(shortcode_atts(array(
          'url' =&gt; '', //url=&quot;adress(with http://)&quot;
     ), $atts));
	 $str = file_get_contents($url);
    if(strlen($str)&gt;0){ //if $str is bigger than &quot;0&quot;
        preg_match(&quot;/\&lt;title \&gt;(.*)\&lt; \/title\&gt;/&quot;,$str,$title); //Target page's header.
	$linkaname = '&lt;a href=&quot;'.$url.'&quot; target=&quot;_blank&quot; title=&quot;'.$title[1].'&quot;&gt;'.$title[1].'&lt;/a&gt;'; //Link
        return $linkaname; //Get link with $linkaname
		}
}
add_shortcode('linkname', 'link_ismi_getir');
//Shortcode maker :)</pre>
<p>Add this code into functions.php which file in your theme&#8217;s. After that you can use this shortcode with your posts.</p>
<pre class="brush: php; title: ; notranslate">[linkname url=&quot;http://yourtargeturl.com&quot;]</pre>
<p>The Sample is here (Turkish) <a href="http://www.kaisercrazy.com/cms-sistemleri/wordpress/linklerin-isimleriyle-gostermek.html" target="_blank">Click</a></p>
<p>Simple isn&#8217;t it :)</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/show-link-with-page-names.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Share, Like, Send and other social buttons&#8230;</title>
		<link>http://wpfunc.com/wordpress/share-like-send-and-other-social-buttons.html</link>
		<comments>http://wpfunc.com/wordpress/share-like-send-and-other-social-buttons.html#comments</comments>
		<pubDate>Fri, 20 May 2011 21:27:55 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[like]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[send]]></category>
		<category><![CDATA[share]]></category>
		<category><![CDATA[social]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=479</guid>
		<description><![CDATA[You can add social buttons with this litte function. Let&#8217;s begin&#8230; Here is the code; Add this code in your theme&#8217;s functions.php You have to change  areas for your theme &#38; site. Download this javascript files and upload into your theme. Sample Image]]></description>
			<content:encoded><![CDATA[<p>You can add social buttons with this litte function. Let&#8217;s begin&#8230;<span id="more-479"></span></p>
<h3>Here is the code;</h3>
<p>Add this code in your theme&#8217;s <strong>functions.php</strong> </p>
<pre class="brush: php; title: ; notranslate">//Like &amp; Share &amp; Send etc.
//Add After the_content
add_filter('the_content', cagirbeni);
function cagirbeni($content) {
$sayfalink = get_permalink();

//Importanat Area
$fappId = &quot;126927697318171&quot;; //Your Facebook AppID or same with this.
$twittervia = &quot;kaisercrazy&quot;; //Write your twitter username.
$temaklasoru =&quot;kaisercrazy/javascripts&quot;; //Path of your javascript files in your theme.
//Importanat Area

	if(is_single()) {
	$content .= $button = '&lt;div style=&quot;height:21px;margin-bottom:10px;&quot;&gt;&lt;div id=&quot;fb-root&quot;&gt;&lt;/div&gt;&lt;script src=&quot;http://connect.facebook.net/en_US/all.js#appId='.$fappId.'&amp;amp;xfbml=1&quot;&gt;&lt;/script&gt;&lt;fb:like href=&quot;'.$sayfalink.'&quot; send=&quot;true&quot; width=&quot;170&quot; show_faces=&quot;false&quot; layout=&quot;button_count&quot; font=&quot;segoe ui&quot;&gt;&lt;/fb:like&gt;&lt;div style=&quot;float:right;height:20px;margin-bottom:15px;&quot;&gt;&lt;a href=&quot;http://twitter.com/share&quot; class=&quot;twitter-share-button&quot; data-count=&quot;horizontal&quot; data-via=&quot;'.$twittervia.'&quot;&gt;Tweet&lt;/a&gt;&lt;script type=&quot;text/javascript&quot; src=&quot;/wp-content/themes/'.$temaklasoru.'/twitter.js&quot;&gt;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot; src =&quot;/wp-content/themes/'.$temaklasoru.'/buttons.js&quot;&gt;&lt;/script&gt;&lt;a class=&quot;DiggThisButton DiggCompact&quot; rev=&quot;news, technology&quot;&gt;&lt;/a&gt;&lt;div id=&quot;fb_share_1&quot; style=&quot;float:right;margin-left: 10px;&quot;&gt;&lt;a name=&quot;fb_share&quot; type=&quot;button_count&quot; share_url=&quot;'.$sayfalink.'&quot; href=&quot;http://www.facebook.com/sharer.php&quot;&gt;Paylaş&lt;/a&gt; &lt;/div&gt;&lt;script src=&quot;/wp-content/themes/'.$temaklasoru.'/FB.Share.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;/div&gt;&lt;/div&gt;';
}
	return $content ;
}
//Like &amp; Share &amp; Send etc.</pre>
<p>You have to change  areas for your theme &amp; site. Download this javascript files and upload into your theme.<br />
Note: There is a file embedded within this post, please visit this post to download the file.<br />
</p>
<h3>Sample Image</h3>
<p><a class="highslide img_2" href="http://www.wpfunc.com/wp-content/uploads/2011/05/social-area.png" onclick="return hs.expand(this)"><img src="http://www.wpfunc.com/wp-content/uploads/2011/05/social-area.png" alt="" title="social-area" width="655" height="32" class="alignnone size-full wp-image-480" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/share-like-send-and-other-social-buttons.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Category Cloud!</title>
		<link>http://wpfunc.com/wordpress/category-cloud.html</link>
		<comments>http://wpfunc.com/wordpress/category-cloud.html#comments</comments>
		<pubDate>Tue, 15 Mar 2011 12:07:43 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[tag cloud]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=470</guid>
		<description><![CDATA[You can make category cloud like tag cloud with this function. Here is the code; Insert this code into your theme&#8217;s functions.php; And use this code where you want; Have a nice day!]]></description>
			<content:encoded><![CDATA[<p>You can make category cloud like tag cloud with this function.<br />
<span id="more-470"></span></p>
<h3>Here is the code;</h3>
<p>Insert this code into your theme&#8217;s <span style="color: #ff0000;"><strong>functions.php</strong></span>;</p>
<pre class="brush: php; title: ; notranslate">//Category cloud
function nube(){
  $categories=  get_categories('child_of=0&amp;type=post&amp;orderby=name&amp;number=500rand&amp;order=asc');
  foreach ($categories as $category) {
	  $font=@intval($category-&gt;category_count/2);

	  $color=&quot;#000000&quot;;
	  if($font&lt;10){
		  $font=10;
		  $color=&quot;#AAAAAA&quot;;
	  }
	  if($font&gt;15 &amp;&amp; $font&lt;30){
		  $font=15;
		  $color=&quot;#8CC7FF&quot;;
	  }
	if($font&gt;=30){
		$font=30;
		$color=&quot;#ff0000&quot;;
	}

	if($category-&gt;category_count&gt;4){
  	$resp .= '&lt;a title=&quot;Total Article: '.$category-&gt;category_count.'&quot;style=&quot;font-size:'.$font.'px;color:'.$color.'&quot; href=&quot;/category/'.$category-&gt;category_nicename.'&quot;&gt;'.$category-&gt;cat_name.'&lt;/a&gt; ';
			}
  }
  return $resp;
}
//Category Cloud</pre>
<p>And use this code where you want;</p>
<pre class="brush: php; title: ; notranslate">&lt;?php echo nube(); ?&gt;</pre>
<p>Have a nice day!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/category-cloud.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamic Meta Description</title>
		<link>http://wpfunc.com/wordpress/dynamic-meta-description.html</link>
		<comments>http://wpfunc.com/wordpress/dynamic-meta-description.html#comments</comments>
		<pubDate>Fri, 17 Dec 2010 09:04:46 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[edit]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[header.php]]></category>
		<category><![CDATA[meta description]]></category>
		<category><![CDATA[meta tags]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=465</guid>
		<description><![CDATA[WordPress using blog description with meta description. But we want to sync. with search terms and posts. We can do that without a plugin. Let&#8217;s begin. We can make this via functions.php. If we make a function about this we can use posts excerpt with meta tag description. Here is the code; Make a copy [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress using blog description with meta description. But we want to sync. with search terms and posts. We can do that without a plugin. Let&#8217;s begin.</p>
<p><span id="more-465"></span>We can make this via functions.php. If we make a function about this we can use posts excerpt with meta tag description.</p>
<h3>Here is the code;</h3>
<p>Make a copy of your <strong><span style="color: #0000ff;">theme&#8217;s</span></strong> <span style="color: #ff0000;"><strong>functions.php</strong></span> and add this code before <strong><span style="color: #ff0000;">?&gt;</span></strong></p>
<pre class="brush: php; title: ; notranslate">
function dynamic_meta_description() {
	$rawcontent = 	get_the_content();
	if(empty($rawcontent)) {
		$rawcontent = htmlentities(bloginfo('description'));
	} else {
		$rawcontent = apply_filters('the_content_rss', strip_tags($rawcontent));
		$rawcontent = preg_replace('/\[.+\]/','', $rawcontent);
		$chars = array(&quot;&quot;, &quot;\n&quot;, &quot;\r&quot;, &quot;chr(13)&quot;,  &quot;\t&quot;, &quot;&#92;&#48;&quot;, &quot;\x0B&quot;);
		$rawcontent = htmlentities(str_replace($chars, &quot; &quot;, $rawcontent));
	}
	if (strlen($rawcontent) &lt; 155) {
		echo $rawcontent;
	} else {
		$desc = substr($rawcontent,0,155);
		return $desc;
	}
}
</pre>
<p>Save functions.php and place it to your theme&#8217;s folder. In this code we use <strong><span style="color: #ff0000;">get_the_contet()</span></strong> function for call our post.<br />
After that you can use this code into your header.php for meta descripton.</p>
<pre class="brush: php; title: ; notranslate">&lt;meta name=&quot;description&quot; content=&quot;&lt;?php echo dynamic_meta_description(); ?&gt;&quot; /&gt;</pre>
<p>That&#8217;s All.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/dynamic-meta-description.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Send e-mail to users about your new post!</title>
		<link>http://wpfunc.com/wordpress/send-e-mail-to-users-about-your-new-post.html</link>
		<comments>http://wpfunc.com/wordpress/send-e-mail-to-users-about-your-new-post.html#comments</comments>
		<pubDate>Tue, 26 Oct 2010 15:18:47 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[send email]]></category>
		<category><![CDATA[subscribe]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=460</guid>
		<description><![CDATA[There is no need subscribe plugins. You can send e-mails to your users. When you write a new article WordPress automatically send a new mail to your users. This is a simple trick on functions.php. Here is the code; Open your theme&#8217;s functions.php and add this code before the last ?&#62; Save functions.php and send [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">There is no need subscribe plugins. You can send e-mails to your users. When you write a new article WordPress automatically send a new mail to your users. This is a simple trick on functions.php.<span id="more-460"></span></p>
<p style="text-align: justify;">Here is the code;</p>
<p style="text-align: justify;">Open <strong>your theme&#8217;s <span style="color: #ff0000;">functions.php</span></strong> and add this code before the last <span style="color: #ff0000;"><strong>?&gt;</strong></span></p>
<pre class="brush: php; title: ; notranslate">function email_members($post_ID)  {
    global $wpdb;
    $usersarray = $wpdb-&gt;get_results(&quot;SELECT user_email FROM $wpdb-&gt;users;&quot;);
    $users = implode(&quot;,&quot;, $usersarray);
    mail($users, &quot;There is a new postı!&quot;, 'There is anew post on http://www.yoursiteurl.com!');
    return $post_ID;
}

add_action('publish_post', 'email_members');
</pre>
<p style="text-align: justify;">Save functions.php and send it to server. That&#8217;s All!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/send-e-mail-to-users-about-your-new-post.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Wp Menu System on Old themes&#8230;</title>
		<link>http://wpfunc.com/wordpress/new-wp-menu-system-on-old-themes.html</link>
		<comments>http://wpfunc.com/wordpress/new-wp-menu-system-on-old-themes.html#comments</comments>
		<pubDate>Fri, 09 Jul 2010 09:05:32 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[fallback_cp]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[header.php]]></category>
		<category><![CDATA[menu sistemi]]></category>
		<category><![CDATA[menu_order]]></category>
		<category><![CDATA[sor_column]]></category>
		<category><![CDATA[theme_location]]></category>
		<category><![CDATA[wordpress 3.0]]></category>
		<category><![CDATA[wp-admin]]></category>
		<category><![CDATA[wp_categories_menu]]></category>
		<category><![CDATA[wp_nav_menu]]></category>
		<category><![CDATA[wp_page_menu]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=457</guid>
		<description><![CDATA[With this article i&#8217;ll show you how to use new wordpress menu system on old themes (before 3.0). Let&#8217;s Begin. Open your theme&#8217;s functions.php with your favourite php editor. After that add this code into file. First code for theme menu support, second code for register a menu area for use. After that save functions.php [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">With this article i&#8217;ll show you how to use new wordpress menu system on old themes (before 3.0). Let&#8217;s Begin.<span id="more-457"></span></p>
<p style="text-align: justify;">Open your theme&#8217;s <span style="color: #ff0000;"><strong>functions.php</strong></span> with your favourite php editor. After that add this code into file. First code for theme menu support, second code for register a menu area for use.</p>
<pre class="brush: php; title: ; notranslate">// New Menu Support For theme //
add_theme_support( 'nav-menus' );</pre>
<pre class="brush: php; title: ; notranslate">register_nav_menu('main', 'Main Navigation Area');</pre>
<p style="text-align: justify;">After that save functions.php and upload the server. After that open your <span style="color: #ff0000;"><strong>header.php</strong></span> and replace all that code with your old menu code (wp_page_menu, wp_categories_menu).</p>
<pre class="brush: php; title: ; notranslate">&lt;?php wp_nav_menu( array( 'theme_location' =&gt; 'main', 'sort_column' =&gt; 'menu_order', 'fallback_cb' =&gt; 'wp_page_menu' ) ); ?&gt;</pre>
<p style="text-align: justify;">After that you can use new menu system with your old theme. And if you don&#8217;t wat to use new menu. This code add <strong>wp_page_menu</strong> for you.</p>
<p style="text-align: justify;">That&#8217;s All.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/new-wp-menu-system-on-old-themes.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Delay your feed updates</title>
		<link>http://wpfunc.com/wordpress/delay-your-feed-updates.html</link>
		<comments>http://wpfunc.com/wordpress/delay-your-feed-updates.html#comments</comments>
		<pubDate>Thu, 01 Jul 2010 07:47:49 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[delay]]></category>
		<category><![CDATA[delay time]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[publish time]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=454</guid>
		<description><![CDATA[You can set the feed update time with a simple function. The only need you have to edit your theme&#8217;s functions.php. Let&#8217;s Begin. Here is the code; With this code update will wait for 5 minutes. You can chnge this time period. Just change $wait value for this. That&#8217;s All. Have a nice day.]]></description>
			<content:encoded><![CDATA[<p>You can set the feed update time with a simple function. The only need you have to edit your theme&#8217;s functions.php. Let&#8217;s Begin.<span id="more-454"></span></p>
<h3>Here is the code;</h3>
<pre class="brush: php; title: ; notranslate">// delay feed update
function publish_later_on_feed($where) {
	global $wpdb;

	if (is_feed()) {
		// timestamp in WP-format
		$now = gmdate('Y-m-d H:i:s');

		// value for wait; + device
		$wait = '5'; // integer

		// http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timestampdiff
		$device = 'MINUTE'; // MINUTE, HOUR, DAY, WEEK, MONTH, YEAR

		// add SQL-sytax to default $where
		$where .= &quot; AND TIMESTAMPDIFF($device, $wpdb-&gt;posts.post_date_gmt, '$now') &gt; $wait &quot;;
	}
	return $where;
}
add_filter('posts_where', 'publish_later_on_feed');</pre>
<p>With this code update will wait for 5 minutes. You can chnge this time period. Just change <span style="color: #ff0000;"><strong>$wait</strong></span> value for this.<br />
That&#8217;s All. Have a nice day.</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/delay-your-feed-updates.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Numbers next to each post!</title>
		<link>http://wpfunc.com/wordpress/add-numbers-next-to-each-post.html</link>
		<comments>http://wpfunc.com/wordpress/add-numbers-next-to-each-post.html#comments</comments>
		<pubDate>Mon, 19 Apr 2010 21:23:21 +0000</pubDate>
		<dc:creator></dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[article]]></category>
		<category><![CDATA[article numbers]]></category>
		<category><![CDATA[article title]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[Loop]]></category>
		<category><![CDATA[trick]]></category>
		<category><![CDATA[wordpress forums]]></category>
		<category><![CDATA[wprecipes]]></category>

		<guid isPermaLink="false">http://www.wpfunc.com/?p=425</guid>
		<description><![CDATA[I found that trick in WordPress Forums. After i saw this trick into WpRecipes. You can add article numbers (ex. Article #1, Article #2) next to your posts. Let&#8217;s Begin&#8230; Here is the code; Add this code into your theme&#8217;s functions.php; After this you can use this short code when you call your article names. [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">I found that trick in <a href="http://wordpress.org/support/topic/375293?replies=5#post-1453605" target="_blank">WordPress Forums</a>. After i saw this trick into WpRecipes. You can add article numbers (ex. Article #1, Article #2) next to your posts. Let&#8217;s Begin&#8230;<span id="more-425"></span></p>
<h3 style="text-align: justify;">Here is the code;</h3>
<p style="text-align: justify;">Add this code into your <span style="color: #ff0000;"><strong>theme&#8217;s functions.php</strong></span>;</p>
<pre class="brush: php; title: ; notranslate">function updateNumbers() {
/* numbering the published posts: preparation: create an array with the ID in sequence of publication date, /
/ save the number in custom field 'incr_number' of post with ID  /
/ to show in post (within the loop) use &lt;?php echo get_post_meta($post-&gt;ID,'incr_number',true); ?&gt;
/ alchymyth 2010 */
global $wpdb;
$querystr = &quot;SELECT $wpdb-&gt;posts.* FROM $wpdb-&gt;posts WHERE $wpdb-&gt;posts.post_status = 'publish' AND $wpdb-&gt;posts.post_type = 'post' &quot;;
$pageposts = $wpdb-&gt;get_results($querystr, OBJECT);
$counts = 0 ;
if ($pageposts):
foreach ($pageposts as $post):
setup_postdata($post);
$counts++;
add_post_meta($post-&gt;ID, 'incr_number', $counts, true);
update_post_meta($post-&gt;ID, 'incr_number', $counts);
endforeach;
endif;
}

add_action ( 'publish_post', 'updateNumbers' );
add_action ( 'deleted_post', 'updateNumbers' );
add_action ( 'edit_post', 'updateNumbers' );</pre>
<p style="text-align: justify;">After this you can use this short code when you call your article names.</p>
<pre class="brush: php; title: ; notranslate">&lt;?php echo get_post_meta($post-&gt;ID,'incr_number',true); ?&gt; </pre>
<p style="text-align: justify;">That&#8217;s All. Have a nice day!</p>
]]></content:encoded>
			<wfw:commentRss>http://wpfunc.com/wordpress/add-numbers-next-to-each-post.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

