<?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>A Wordpress Development Blog &#187; Featured</title>
	<atom:link href="http://www.binarspace.com/category/featured/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.binarspace.com</link>
	<description>Another WordPress Development Blog</description>
	<lastBuildDate>Mon, 29 Nov 2010 10:34:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Using the Menus in WordPress</title>
		<link>http://www.binarspace.com/wordpress-tips-and-tricks/using-the-menus-in-wordpress/</link>
		<comments>http://www.binarspace.com/wordpress-tips-and-tricks/using-the-menus-in-wordpress/#comments</comments>
		<pubDate>Wed, 17 Nov 2010 10:55:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Wordpress Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.binarspace.com/?p=201</guid>
		<description><![CDATA[Today’s tip is about using the wordpress built in menu functions. If implemented correctly these will let you customize the menus and help you manage the blog much more easier.
]]></description>
			<content:encoded><![CDATA[<p>Today’s tip is about using the wordpress built in menu functions. If implemented correctly these will let you customize the menus and help you manage the blog much more easier.</p>
<p>First you need to open functions.php and “register” the menus. Just put in the following line: </p>
<p><code><br />
register_nav_menus( array(<br />
		'primary' =&gt; __( 'Primary Navigation', 'test binar' ),<br />
		) );</p>
<p></code></p>
<p>The code above will register only one menu. If you want more just extend the array.</p>
<p>Once the menus are registered the only thing that needs to be done is to “mark” their position in the template.</p>
<p>Open the template file (usually header.php) and locate the menu lines.  The menus are built using html code or wordpress functions like wp_list_pages. Replace those lines with:</p>
<p><code></p>
<p>wp_nav_menu( array( 'container_class' =&gt; 'menu-header', 'theme_location' =&gt; 'primary' ) );</p>
<p></code></p>
<p>Save and go in Admin Appearance tab. You will see the Menu interface is enabled and ready to use.Just build a menu, put some links in and assign them to primary location and you are ready to go.</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/how-to-test-different-adsense-units/" title="How to test different Adsense units">How to test different Adsense units</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/content-on-categories-pages/" title="Content on Categories pages">Content on Categories pages</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/exclude-posts-in-multiple-loops/" title="Exclude posts in multiple loops">Exclude posts in multiple loops</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/using-widgets-inside-a-wordpress-theme/" title="Using Widgets inside a Wordpress theme">Using Widgets inside a Wordpress theme</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/moving-kubrick-gradient-into-other-wordpress-themes-part2/" title="Moving Kubrick gradient into other wordpress themes &#8211; part2">Moving Kubrick gradient into other wordpress themes &#8211; part2</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.binarspace.com/wordpress-tips-and-tricks/using-the-menus-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using custom background function to style any other div</title>
		<link>http://www.binarspace.com/wordpress-tips-and-tricks/using-custom-background-function-to-style-any-other-div/</link>
		<comments>http://www.binarspace.com/wordpress-tips-and-tricks/using-custom-background-function-to-style-any-other-div/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 11:34:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Wordpress Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.binarspace.com/?p=142</guid>
		<description><![CDATA[Since version 3.0 wordpress developers have a new design option to play with. It’s about the add_custom_background() function , a new and comfortable way to manage your theme background]]></description>
			<content:encoded><![CDATA[<p>Since version 3.0 wordpress developers have a new design option to play with. It’s about the add_custom_background() function , a new and comfortable way to manage your theme background without editing the css file.</p>
<p>To enable the custom background feature in a theme you just need to paste the add_custom_background(); command in functions.php file and you are in complete control of the background.</p>
<p>Today’s trick is about using the custom background css interface to style any particular div and not the actual theme background.</p>
<p>For this we have to do the following :<br />
- Copy paste the code below in functions.php</p>
<p><code></p>
<p>function new_custom_background_cb() {<br />
	$background = get_background_image();<br />
	$color = get_background_color();<br />
	if ( ! $background &#038;&#038; ! $color )<br />
		return;</p>
<p>	$style = $color ? "background-color: #$color;" : '';</p>
<p>	if ( $background ) {<br />
		$image = " background-image: url('$background');";</p>
<p>		$repeat = get_theme_mod( 'background_repeat', 'repeat' );<br />
		if ( ! in_array( $repeat, array( 'no-repeat', 'repeat-x', 'repeat-y', 'repeat' ) ) )<br />
			$repeat = 'repeat';<br />
		$repeat = " background-repeat: $repeat;";</p>
<p>		$position = get_theme_mod( 'background_position_x', 'left' );<br />
		if ( ! in_array( $position, array( 'center', 'right', 'left' ) ) )<br />
			$position = 'left';<br />
		$position = " background-position: top $position;";</p>
<p>		$attachment = get_theme_mod( 'background_attachment', 'scroll' );<br />
		if ( ! in_array( $attachment, array( 'fixed', 'scroll' ) ) )<br />
			$attachment = 'scroll';<br />
		$attachment = " background-attachment: $attachment;";</p>
<p>		$style .= $image . $repeat . $position . $attachment;<br />
	}<br />
?&gt;<br />
&lt;style type="text/css"&gt;<br />
#page { &lt;?php echo trim( $style ); ?&gt; }<br />
&lt;/style&gt;<br />
&lt;?php<br />
}</p>
<p></code></p>
<p>The function has the same code as <em>_custom_background_cb()</em> function, that you can found in theme.php and is responsible with building the background style . The only change is on line <em>#page { &lt;?php echo trim( $style ); ?&gt; }</em>. </p>
<p>Here we just replaced the body with #page. So the generated style will be applied to the #page div (or another div that you chose) instead of body.</p>
<p>To call the modified function you just need to add her name as first parameters for the <em>add_custom_background();</em><br />
So add this line in functions.php and your done</p>
<p><code><br />
add_custom_background(new_custom_background_cb,'','');<br />
</code></p>
<p>The second trick is to make the custom style sheet to be applied only on home page.</p>
<p>In the same function as above add <em> if (is_home())</em>  before the <em> &lt;style type=&#8221;text/css&#8221;&gt;</em> . Of course make sure you close the conditional tag and also you can switch back from #page to body if you want the background only for the main page.</p>
<p>The code will look like :</p>
<p><code></p>
<p>//  the rest of the original function.<br />
if (is_home()){<br />
?&gt;</p>
<p>&lt;style type="text/css"&gt;<br />
body { &lt;?php echo trim( $style ); ?&gt; }<br />
&lt;/style&gt;<br />
&lt;?php<br />
}<br />
}</p>
<p></code></p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/display-post-images-via-custom-fields/" title="Display post images via Custom fields">Display post images via Custom fields</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/update_optionget_option-and-php-serialize/" title="Update_option/get_option and PHP serialize">Update_option/get_option and PHP serialize</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/add-custom-content-afteror-before-each-post/" title="Add custom content after(or before) each post">Add custom content after(or before) each post</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/random-posts-in-wordpress/" title="Random posts in Wordpress">Random posts in Wordpress</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/custom-length-for-excerpts/" title="Custom length for excerpts">Custom length for excerpts</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.binarspace.com/wordpress-tips-and-tricks/using-custom-background-function-to-style-any-other-div/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automatically insert Adsense code in old posts.</title>
		<link>http://www.binarspace.com/wordpress-tips-and-tricks/automatically-insert-adsense-code-in-old-posts/</link>
		<comments>http://www.binarspace.com/wordpress-tips-and-tricks/automatically-insert-adsense-code-in-old-posts/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 12:02:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Wordpress Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.binarspace.com/?p=131</guid>
		<description><![CDATA[There are many situations when old blogs with tons of posts and traffic are not monetized at all. At one point the owner may decide to publish ads(or some other commercial stuff) inside posts.  But how ? Editing 300+ posts to manually insert ads is not really a solution if you are an individual.]]></description>
			<content:encoded><![CDATA[<p>There are many situations when old blogs with tons of posts and traffic are not monetized at all. At one point the owner may decide to publish ads(or some other commercial stuff) inside posts.  But how ? Editing 300+ posts to manually insert ads is not really a solution if you are an individual.</p>
<p>Here is a quick solution. The code below will take your posts, split them by  ‘&lt;p&gt;’  tags (paragraphs) and insert a code every x(a number you can change) paragraphs. </p>
<p>Copy paste the code in your functions.php and replace the $commercial value with your ad code .I promise I will make a plugin that will do this but in a friendly manner.</p>
<p><code></p>
<p>add_filter('the_content', 'display_autoadsense');</p>
<p>function display_autoadsense($content){	</p>
<p>$commercial=' --->> Copy paste here the adsense code << ---';<br />
$needle='&lt;/p&gt;';<br />
$bum=explode($needle,$content);<br />
$count=0;<br />
$every=3; </p>
<p>foreach ($bum as $key =&gt; $value) {<br />
	$count++;<br />
	if($count ===$every){<br />
		$new_content= $new_content.$value.'&lt;/p&gt;&lt;p&gt;'.$commercial.'&lt;/p&gt;';<br />
$count=0;<br />
}</p>
<p>	else {<br />
		$new_content= $new_content.$value.'&lt;/p&gt;';<br />
		}</p>
<p>}</p>
<p>return $new_content;<br />
} </p>
<p></code></p>
<p>Change the value of $every  with the no of paragraphs  you want between ads. Remove the $ count=0; line if you want to display ads only one time.</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/random-posts-in-wordpress/" title="Random posts in Wordpress">Random posts in Wordpress</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/update_optionget_option-and-php-serialize/" title="Update_option/get_option and PHP serialize">Update_option/get_option and PHP serialize</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/add-a-subtitle-under-the-post-title/" title="Add a subtitle under the post title">Add a subtitle under the post title</a></li><li><a href="http://www.binarspace.com/headline/binar-zeo-theme-beta-release/" title="Binar Zeo Theme &#8211; Beta Release">Binar Zeo Theme &#8211; Beta Release</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/adding-content-in-footerheader-without-changing-theme-files/" title="Adding content in footer/header without changing theme files">Adding content in footer/header without changing theme files</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.binarspace.com/wordpress-tips-and-tricks/automatically-insert-adsense-code-in-old-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving Kubrick gradient into other wordpress themes</title>
		<link>http://www.binarspace.com/wordpress-tips-and-tricks/moving-kubrick-gradient-into-other-wordpress-themes/</link>
		<comments>http://www.binarspace.com/wordpress-tips-and-tricks/moving-kubrick-gradient-into-other-wordpress-themes/#comments</comments>
		<pubDate>Thu, 28 Oct 2010 11:29:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Wordpress Tips and Tricks]]></category>

		<guid isPermaLink="false">http://www.binarspace.com/?p=106</guid>
		<description><![CDATA[Today’s recipe is a little more complicated than the usual ones and it will be in two parts. I will show you how you can "move" the header gradient generator from good old Kubrick theme into any other theme.]]></description>
			<content:encoded><![CDATA[<p>Today’s recipe is a little more complicated than the usual ones and it will be in two parts. I will show you how you can &#8220;move&#8221; the header gradient generator from good old Kubrick theme into any other theme.</p>
<p>I started the research by looking into the script that creates this gradient for Kubrick theme and even if we could write a new one from scratch I think it will be faster if we just adjust the original. </p>
<p><strong>Step 1</strong><br />
First step is to copy the header-img.php from default theme into your new theme and open it for editing. If you don’t have it you can download it from <a href="http://www.binarspace.com/downloads/kubrick_gradient.rar">here</a>. </p>
<p>The first line of code is this one <em> $img = &#8216;kubrickheader.jpg&#8217;;</em> </p>
<p>The &#8216;kubrickheader.jpg&#8217; is the actual canvas where the gradient script will do the job. If you open the image you will see that the gradient fills an area inside a round corner container and there are white borders + a gray background.</p>
<p><a href="http://www.binarspace.com/wp-content/uploads/2010/10/kubrickheader.jpg"><img src="http://www.binarspace.com/wp-content/uploads/2010/10/kubrickheader-300x78.jpg" alt="" title="kubrickheader" width="300" height="78" class="aligncenter size-medium wp-image-111" /></a></p>
<p>The script needs to find this image so you have two options:  copy it from the default theme or create a new one with an imagine editing software. </p>
<p>At this point is good to know the height and width of the gradient we will create.  For the purpose of this tutorial we will assume that a height of 200 and a width of 760 are the values we need (these are &#8216;kubrickheader.jpg&#8217; sizes.)</p>
<p>The next lines of code represent the validation of the color codes we sent via GET. Btw the script will be called like this:<br />
<em>http://yoursite.com/wp-content/themes/yourtheme/header-img.php?upper=000033&#038;lower=F3F3F3</em><br />
Where upper and lower variable represent the 2 base colors for gradient.</p>
<p><strong>Step 2</strong><br />
Remove from file the definition of the $white variable and the $corner array – we will not do round corners on this example (You can keep it if you plan to use corners).</p>
<p><strong>Step 3 </strong><br />
Now set the height of your gradient (in our case it will have the same height as the default image).So in code you should have </p>
<p><code>$h=200;</code></p>
<p><strong>Step 4</strong><br />
Remove the &#8220;Blank out the blue thing&#8221; code since we will not using it.</p>
<p><strong>Step 5</strong><br />
In the  &#8220;Draw a new color thing&#8221; piece of code set the x1 and x2 values to 0 and 760. These values are left and right gradient limits and in our case they will be default image limits. Move the x1 and x2 declarations near the h value set in Step3. This is just to have all the gradient size variables in one place.</p>
<p>Near $h declaration make a new variable called $from and set it to 0. The $ from variable is the start point on y scale. When it’s 0, it means the gradient will start from top margin.</p>
<p><strong>Step 6</strong><br />
Comment or remove the If block in the “Draw a new color thing” area. It&#8217;s corner related.</p>
<p><strong>Step 7</strong><br />
In the imageline instruction replace the number 18  with the $from variable. In the original script the gradient starts 18px after the top margin. In our case we control the start point with the $from variable.<br />
<code><br />
imageline( $im, $x1, $from + $i, $x2, $from + $i, $color );<br />
</code></p>
<p><strong>Step 8 </strong><br />
Test the script :<br />
<em>http://yoursite.com/wp-content/themes/yourtheme/header-img.php?upper=000033&#038;lower=F3F3F3</em></p>
<p>It should produce a image of 200 px height , 760px wide containing a color gradient that starts from rgb color of #000033 and ends at rgb color of  #F3F3F3.</p>
<p><strong>The extra control.</strong><br />
If you want to draw this gradient inside a image , just like the original Kubrick script does , you can set new values for  x1 and x2(as start and end points on horizontal), $from as starting point on vertical and for  $h as the gradient height.</p>
<p>This set of values:  $x1=20, $x2=740, $from=20 and $h=160 will create a gradient inside the default image and leave of border of 20px around it.</p>
<p>If you want to have corners for the gradient you have the put back the lines we removed and play with the values from corner array.(start with the values from original script.)</p>
<p>Note:<br />
If you want to use the gradient as background for a div (and you don’t have corners) you don’t need to generate a wide image. A 5 px wide jpeg will do (you will tile it horizontally) and will make the gradient script much faster.</p>
<p>In the second part we will make a menu in admin and a page where users can choose the gradient colors.</p>
<p>Download the modifed script <a href="http://www.binarspace.com/downloads/kubrick_gradient.rar">here</a>.<br />
You can view the output of this example <a href="http://www.binarspace.com/downloads/header-img-edited.php?upper=000033&#038;lower=F3F3F3">here </a>.</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/custom-length-for-excerpts/" title="Custom length for excerpts">Custom length for excerpts</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/how-to-re-start-a-wordpress-blog/" title="How to re start a wordpress blog">How to re start a wordpress blog</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/display-post-images-via-custom-fields/" title="Display post images via Custom fields">Display post images via Custom fields</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/using-custom-background-function-to-style-any-other-div/" title="Using custom background function to style any other div">Using custom background function to style any other div</a></li><li><a href="http://www.binarspace.com/wordpress-tips-and-tricks/share-on-facebook-code-for-wordpress/" title="Share on Facebook code for Wordpress">Share on Facebook code for Wordpress</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.binarspace.com/wordpress-tips-and-tricks/moving-kubrick-gradient-into-other-wordpress-themes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

