<?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>WPTidBits &#187; Tutorials</title> <atom:link href="http://wptidbits.com/category/tutorials/feed/" rel="self" type="application/rss+xml" /><link>http://wptidbits.com</link> <description>Wordpress For The Rest of Us</description> <lastBuildDate>Sat, 04 Sep 2010 19:54:52 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Display Random Post in WordPress Sidebar</title><link>http://wptidbits.com/tutorials/display-random-post-in-wordpress-sidebar/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=display-random-post-in-wordpress-sidebar</link> <comments>http://wptidbits.com/tutorials/display-random-post-in-wordpress-sidebar/#comments</comments> <pubDate>Sat, 04 Sep 2010 16:41:17 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Tutorials]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[sidebar]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://wptidbits.com/?p=914</guid> <description><![CDATA[We have been using plugins to display random posts on our sidebar. As all may have known, avoiding the use of plugins may decrease the loading speed of any wordpress website. We have started using these very simple line of codes just to make that happen. So how do we display random posts in Wordpress sidebar without any plugins?  ]]></description> <content:encoded><![CDATA[<p>We have been using plugins to display random posts on our sidebar. As all may have known, avoiding the use of plugins may decrease the loading speed of any wordpress website. We have started using these very simple line of codes just to make that happen. So how do we display random posts in WordPress sidebar without any plugins?</p><h3>The Code</h3><p>Just simply open you <strong><em>sidebar.php</em></strong> or on any file (eg:tab.php etc) where you need it to appear on sidebar and paste these codes.</p><pre class="brush: php">

&lt;h2&gt;Random Posts&lt;/h2&gt;
&lt;ul&gt;
&lt;?php $posts = get_posts(&#039;orderby=rand&amp;amp;numberposts=3&#039;); foreach($posts as $post) { ?&gt;
&lt;li&gt;&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;&lt;?php the_title(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;br /&gt;
&lt;span&gt;&lt;?php the_excerpt(); ?&gt;&lt;br /&gt;&lt;em&gt;&amp;amp;mdash;Posted on &lt;?php the_time(&#039;n/j/Y&#039;) ?&gt;&lt;/em&gt;&lt;/span&gt;&lt;/a&gt;
&lt;/li&gt;
&lt;?php } ?&gt;
&lt;/ul&gt;
</pre><p>Simply troubleshoot, try and see how it looks like until you satisfy with it. Enjoy!</p> ]]></content:encoded> <wfw:commentRss>http://wptidbits.com/tutorials/display-random-post-in-wordpress-sidebar/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>21 Most Popular .htaccess Hacks for WordPress</title><link>http://wptidbits.com/tutorials/21-most-popular-htaccess-hacks-for-wordpress/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=21-most-popular-htaccess-hacks-for-wordpress</link> <comments>http://wptidbits.com/tutorials/21-most-popular-htaccess-hacks-for-wordpress/#comments</comments> <pubDate>Sun, 15 Aug 2010 13:03:23 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Tutorials]]></category> <category><![CDATA[.htaccess]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://wptidbits.com/?p=800</guid> <description><![CDATA[.htaccess, the file which controls the Apache webserver behavior, is very useful and allows us to do a lot of things, mostly for security reasons. Now let's see how these most popular .htaccess hacks can help us with our WordPress blog for security, functionality and usability.]]></description> <content:encoded><![CDATA[<p><em><strong>.htaccess</strong></em>, the file which controls the Apache webserver behavior, is very useful and allows us to do a lot of things, mostly for security reasons. Now let&#8217;s see how these most popular .htaccess hacks can help us with our WordPress blog for security, functionality and usability.</p><p><img
class="alignnone size-full wp-image-803" title="htaccess" src="http://wptidbits.com/wp-content/uploads/2010/08/htaccess.jpg" alt="" width="500" height="315" /></p><h3>Keep This in Mind</h3><p>What we need to do is open the existing <em><strong>.htaccess</strong></em> file on your wordpress blog and paste the hack codes below OR create new <em><strong>.htaccess</strong></em> file if it does not exist. Upload to your site root and chmod it to 644 to protect it from malicious hacker types.</p><p>Be sure to keep the original working <em><strong>.htaccess</strong></em> as backup just in case you need to revert to original settings.</p><h3>The Hacks</h3><ul><li><strong>Protect the .htaccess file itself</strong></li></ul><pre class="brush: php">

# protect the htaccess file
&lt;files .htaccess&gt;
order allow,deny
deny from all
&lt;/files&gt;
</pre><ul><li><strong>Protect the <em>wpconfig.php</em> file</strong></li></ul><pre class="brush: php">

# protect wpconfig.php
&lt;files wp-config.php&gt;
order allow,deny
deny from all
&lt;/files&gt;
</pre><ul><li><strong>Disable the Server Signature from showing</strong></li></ul><pre class="brush: php">

# disable the server signature
ServerSignature Off
</pre><ul><li><strong>Limit the File upload size</strong></li></ul><pre class="brush: php">

# limit file uploads to 10mb
LimitRequestBody 10240000
</pre><ul><li><strong>Blacklist undesired users and bots ip address<br
/> </strong></li></ul><pre class="brush: php">

#who has access and who doesnt
&lt;Limit GET POST PUT&gt;
order allow,deny
allow from all
deny from 123.456.789
deny from 93.121.788
deny from 223.956.789
deny from 128.456.780
&lt;/LIMIT&gt;
</pre><ul><li><strong>Allow only your IP adress on the wp-admin directory</strong></li></ul><pre class="brush: php">

AuthUserFile /dev/null
AuthGroupFile /dev/null
AuthName &quot;Example Access Control&quot;
AuthType Basic
&lt;LIMIT GET&gt;
order deny,allow
deny from all
allow from xx.xx.xx.xx
&lt;/LIMIT&gt;
</pre><p>Be sure to put your ip address on line xx.xx.xx.xx. You can allow more ip address by adding another ip address on next line.<br
/> <strong> </strong></p><p><strong><br
/> </strong></p><ul><li><strong> Redirect users to Custom Error page</strong></li></ul><pre class="brush: php">

#custom error docs
ErrorDocument 404 /notfound.php
ErrorDocument 403 /forbidden.php
ErrorDocument 500 /error.php
</pre><ul><li><strong>Prevent directory browsing</strong></li></ul><pre class="brush: php">

# disable/prevent directory browsing
Options All –Indexes
</pre><ul><li><strong>Redirect ‘Day &amp; Name’ permalinks structure to new permalinks structure of /%postname%/ without losing any backlinks</strong></li></ul><p>The first thing to do is to login to your WordPress admin, go to Settings → Permalinks and select custom. Fill out the field with /%postname%/.</p><p>The permalinks will look like this one below:</p><p><em><strong>http://www.yourblog.com/name-of-the-post</strong></em></p><p>Now open .htaccess file or create new one if not exist. Paste this code inside it.</p><pre class="brush: php">

RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$ http://www.domain.com/$4
</pre><p>Now you should have all backlinks with the new permalinks structure.</p><ul><li><strong>Remove /category/ from WordPress url</strong></li></ul><p>Now what we want to do is to change</p><p><em><strong>http://www.domain.com/blog/category/postname</strong></em></p><p>to</p><p><em><strong>http://www.domain.com/blog/postname</strong></em></p><p>Just paste the code below onto the .htaccess file</p><pre class="brush: php">

RewriteRule ^category/(.+)$ http://www.yourblog.com/$1 [R=301,L]
</pre><p><strong><br
/> </strong></p><ul><li><strong> Redirect WordPress RSS feeds to feedburner with .htaccess</strong></li></ul><pre class="brush: php">

# temp redirect wordpress content feeds to feedburner
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} !FeedBurner    [NC]
RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC]
RewriteRule ^feed/?([_0-9a-z-]+)?/?$ http://feeds2.feedburner.com/catswhocode [R=302,NC,L]
&lt;/IfModule&gt;
</pre><p>Do not forget to change the feedburner url to your own feedburner url.</p><ul><li><strong>Block referring domains</strong></li></ul><p>For this example is digg. But who don’t want referal from Digg? <img
src='http://wptidbits.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> This is just for example. You can put any domain name.</p><pre class="brush: php">

#block referring domains
RewriteEngine on
RewriteCond %{HTTP_REFERER} digg\.com [NC]
RewriteRule .* – [F]
</pre><ul><li><strong>Disable hotlinking of images with forbidden or custom image option</strong></li></ul><pre class="brush: php">

RewriteEngine On
#Replace ?mysite\.com/ with your blog url
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^$
#Replace /images/nohotlink.jpg with your &quot;don&#039;t hotlink&quot; image url
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlink.jpg [L]
</pre><ul><li><strong>Setting canonical url manually using .htaccess</strong></li></ul><pre class="brush: php">

# set the canonical url
RewriteEngine On
RewriteCond %{HTTP_HOST} ^yourdomain\.com$ [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301,L]
</pre><ul><li><strong>Deny comment posting to no referrer requests/ Protect from Spam Comments</strong></li></ul><p>There is also a way that you can protect comment or post spamming using .htaccess.</p><p>This code will look for the referrer (the page from where the commentator came from) and will deny commenting if the commentator tried to access the <em><strong>wp-comments-post.php</strong></em> file without directly coming from your blog.</p><p>Just change the line 4 and specify your blog url there.</p><pre class="brush: php"># protect from spam or post comments
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !.*yourdomain.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$

RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L]</pre><p><strong><br
/> </strong></p><ul><li><strong> Redirect visitors to a maintenance page</strong></li></ul><p>Replace maintenance.html (line 2) by the page you’d like to redirect your visitor and the IP adress on line 3 by your own ip.</p><p>Note that a 302 redirection is used, to avoid search engines indexing the maintenance page instead of your real homepage</p><pre class="brush: php">RewriteEngine on

RewriteCond %{REQUEST_URI} !/maintenance.html$

RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123

RewriteRule $ /maintenance.html [R=302,L]</pre><ul><li><strong>Compress static data</strong></li></ul><pre class="brush: php">

AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
</pre><ul><li><strong>Forcing the use of browser cache</strong></li></ul><pre class="brush: php">

FileETag MTime Size
&lt;ifmodule mod_expires.c&gt;
&lt;filesmatch &quot;\.(jpg|gif|png|css|js)$&quot;&gt;
ExpiresActive on
ExpiresDefault &quot;access plus 1 year&quot;
&lt;/filesmatch&gt;
&lt;/ifmodule&gt;
</pre><ul><li><strong>Protect WordPress Blog From Script Injections</strong></li></ul><pre class="brush: php">

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{QUERY_STRING} (\&lt;|%3C).*script.*(\&gt;|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]
</pre><ul><li><strong>Use .htaccess for php compression </strong></li></ul><p>You can try to use .htaccess to apply php compression, but use this code with caution at your own risk. It might not support your web settings etc.</p><pre class="brush: php">

# php compression – use with caution
&lt;ifmodule mod_php4.c&gt;
php_value zlib.output_compression 16386
&lt;/ifmodule&gt;
</pre><ul><li><strong>Limit the number of Simultaneous Connections</strong></li></ul><pre class="brush: php">

MaxClients &lt; number-of-connections&gt;
</pre><ul><li><strong>Set the Time Zone of the Server</strong></li></ul><pre class="brush: php">

SetEnv TZ America/Indianapolis
</pre><h3>What Else?</h3><p>Refer to these sites for more informations:</p><ul><li><a
title="A to Z of WordPress htaccess Hacks" href="http://wpshout.com/a-to-z-of-wordpress-htaccess-hacks/" target="_self">A to Z of WordPress htaccess Hacks</a></li><li><a
title="The Ultimate Htaccess" href="http://www.askapache.com/htaccess/htaccess.html#htaccess-code-examples" target="_self">The Ultimate Htaccess</a></li><li><a
title="10 Awesome .htaccess Hacks for WordPress" href="http://www.catswhocode.com/blog/10-awesome-htaccess-hacks-for-wordpress" target="_self">10 Awesome .htaccess Hacks for WordPress</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://wptidbits.com/tutorials/21-most-popular-htaccess-hacks-for-wordpress/feed/</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Highlight Search Terms Using jQuery</title><link>http://wptidbits.com/tutorials/highlight-search-terms-using-jquery/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=highlight-search-terms-using-jquery</link> <comments>http://wptidbits.com/tutorials/highlight-search-terms-using-jquery/#comments</comments> <pubDate>Wed, 11 Aug 2010 17:41:51 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Tutorials]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://wptidbits.com/?p=744</guid> <description><![CDATA[One way to spice up the search page is to highlight the search terms within the search results. The way described in this tutorial is using jQuery and will highlight both title and post content. ]]></description> <content:encoded><![CDATA[<p>One way to spice up the search page is to highlight the search terms within the search results. The way described in this tutorial is using jQuery and will highlight both title and post content. Another way is not to use jQuery or using wordpress plugins which will not be describe in this tutorial.</p><p><img
class="alignnone size-full wp-image-745" title="search_terms" src="http://wptidbits.com/wp-content/uploads/2010/08/search_terms.gif" alt="" width="363" height="206" /></p><p>Find your theme&#8217;s <em><strong>functions.php</strong></em> file, and paste the following code:</p><pre class="brush: php">

function hls_set_query() {
$query  = attribute_escape(get_search_query());
if(strlen($query) &gt; 0){
echo &#039;
&lt;script type=&quot;text/javascript&quot;&gt;
var hls_query  = &quot;&#039;.$query.&#039;&quot;;
&lt;/script&gt;
&#039;;
}
}
function hls_init_jquery() {
wp_enqueue_script(&#039;jquery&#039;);
}
add_action(&#039;init&#039;, &#039;hls_init_jquery&#039;);
add_action(&#039;wp_print_scripts&#039;, &#039;hls_set_query&#039;);
</pre><p>After that manually you can open your theme&#8217;s <em><strong>header.php</strong></em> file and paste the following code before the <em><strong>&lt;/head&gt;</strong></em> tag.</p><pre class="brush: php">

&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
.hls { background: #D3E18A; } /* &lt;- Change the CSS style of */
/*    highlighted texts here. */
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
jQuery.fn.extend({
highlight: function(search, insensitive, hls_class){
var regex = new RegExp(&quot;(&lt;[^&gt;]*&gt;)|(\\b&quot;  search.replace(/([-.* ?^${}()|[\]\/\\])/g,&quot;\\$1&quot;)  &quot;)&quot;, insensitive ? &quot;ig&quot; : &quot;g&quot;);
return this.html(this.html().replace(regex, function(a, b, c){
return (a.charAt(0) == &quot;&lt;&quot;) ? a : &quot;&lt;strong class=\&quot;&quot;  hsl_class  &quot;\&quot;&gt;&quot;   c   &quot;&lt;/strong&gt;&quot;;
}));
}
});
jQuery(document).ready(function($){
if(typeof(hls_query) != &#039;undefined&#039;){
$(&quot;#post-area&quot;).highlight(hls_query, 1, &quot;hls&quot;); // &lt;- Change &#039;post-area&#039; to ID of HTML tag you
//    want to highlight search terms in.
}
});
&lt;/script&gt;
</pre><p>Make sure to change the “post-area” in the code to the HTML tag ID (for eg: <strong><em>content</em></strong> or <strong>post</strong>) of the area you want your search terms highlighted. You can also change the way the highlighted text styles by changing the CSS properties of the “.hls” class.</p><p>Enjoy!</p> ]]></content:encoded> <wfw:commentRss>http://wptidbits.com/tutorials/highlight-search-terms-using-jquery/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>How To Put Text Inside WordPress Search Forms</title><link>http://wptidbits.com/tutorials/how-to-put-text-inside-wordpress-search-forms/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-to-put-text-inside-wordpress-search-forms</link> <comments>http://wptidbits.com/tutorials/how-to-put-text-inside-wordpress-search-forms/#comments</comments> <pubDate>Thu, 29 Jul 2010 17:10:02 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Tutorials]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://wptidbits.com/?p=733</guid> <description><![CDATA[Many free themes or blog templates out there comes with default search forms that has empty field without any text in its input area. We believe this is fine, but you can see that many themes also have already started to put default text inside the search form field.It has already become a web 2.0 trends and not just being used in search forms but other form fields also.]]></description> <content:encoded><![CDATA[<p>Many free themes or blog templates out there comes with default search forms that has empty field without any text in its input area. We believe this is fine, but you can see that many themes also have already started to put default text inside the search form field.It has already become a web 2.0 trends and not just being used in search forms but in other form fields also.</p><h3>Why text inside search forms?</h3><p>The text can actually help readers to identify the search area more easily, encouraging them to use it and even clarify the search process for non-experience users. Some examples of texts that you can include in the search box:</p><ul><li>search here</li><li>search</li><li>To search, type and hit enter</li><li>search this blog</li></ul><h3>How to do it</h3><p>Simply locate where is search form code. It can be in <span
style="color: #800000;"><strong><em>sidebar.php</em></strong></span>, <span
style="color: #800000;"><em><strong>header.php</strong></em></span> depending on where it is located. Just find this line of code:</p><pre class="brush: php">

&lt;input type=&quot;text&quot; name=&quot;s&quot; id=&quot;s&quot; size=&quot;20&quot;/&gt;
</pre><p>Then replace the whole code above with this bunch of code:</p><pre class="brush: php">

&lt;input type=&quot;text&quot; name=&quot;s&quot; id=&quot;s&quot; value=&quot;Text to be displayed here&quot; onfocus=&quot;if(this.value==this.defaultValue)this.value=&#039;&#039;;&quot; onblur=&quot;if(this.value==&#039;&#039;)this.value=this.defaultValue;&quot;/&gt;
</pre><p>With a simple code above will give you a clickable, and then dissapearing text inside the search box, and replaced by the texts you typed. When you click on other side than the search box without typing any text, it will reappear again the default search text.</p><h3>More</h3><p>Then you can customize the looks of the font and its color by modifying or adding the suitable css stylesheet.</p><p>To get a nice search result, you can go to our previous post:</p><p><a
title="How to Create SEO Friendly Search URL" href="http://wptidbits.com/tutorials/how-to-create-seo-friendly-search-url/" target="_blank">How to Create SEO Friendly Search URL</a></p> ]]></content:encoded> <wfw:commentRss>http://wptidbits.com/tutorials/how-to-put-text-inside-wordpress-search-forms/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Save Time Using WordPress Shortcodes</title><link>http://wptidbits.com/tutorials/save-time-using-wordpress-shortcodes/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=save-time-using-wordpress-shortcodes</link> <comments>http://wptidbits.com/tutorials/save-time-using-wordpress-shortcodes/#comments</comments> <pubDate>Mon, 19 Jul 2010 16:26:49 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Tutorials]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://wptidbits.com/?p=598</guid> <description><![CDATA[Some repetitive task like twitter code addition in every post may be troublesome for us. There is a simple way that we can do by typing something like [shortcode]. This allowing us to call a php function in any place of the site and saves time. Continue read on to find how to use them. ]]></description> <content:encoded><![CDATA[<p>Some repetitive task like twitter code addition in every post may be troublesome for us. There is a simple way that we can do by typing something like <strong><span
style="color: #800000;">[shortcode]</span></strong>. This allowing us to call a php function in any place of the site and saves time. Continue read on to find how to use them.</p><p>Let say we want to add something like an adsense ads in our post, we can use shortcode such as <strong><span
style="color: #800000;">[adsense]</span></strong>.</p><h3>How it can be done:</h3><p>Open your theme&#8217;s <em><strong>functions.php</strong></em> file and add this code below:</p><pre class="brush: php">

function showads() {
return &#039;&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-1414767574446180&quot;;
/* 468x60, created 10/16/09 whtop01 */
google_ad_slot = &quot;8134999590&quot;;
google_ad_width = 468;
google_ad_height = 60;
//--&gt;
&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
&lt;/script&gt;
&#039;;
}

add_shortcode(&#039;adsense&#039;, &#039;showads&#039;);
</pre><p>Just type <strong><span
style="color: #800000;">[adsense]</span></strong> in any place of your post, adsense ads will appear.</p><h3>Much simpler example:</h3><p>Open <em><strong>functions.php</strong></em> file and add this code below:</p><pre class="brush: php">

function wptidbits() {
return &#039;Have you subscribed to &lt;a href=&quot;http://wptidbits.com&quot;&gt;WPTidBits&lt;/a&gt; posts today?&#039;;
}
</pre><p>Then add this another line below after the above code:</p><pre class="brush: php">

add_shortcode(&#039;wtb&#039;, &#039;wptidbits&#039;);
</pre><p>Now you are able to use your own <strong><span
style="color: #800000;">[wtb]</span></strong> code as a shortcode. Just paste the shortcode into any place on post (in HTML mode).</p><p>These two are the simplest examples i can give. Surely if you do try using it always and be creative, you will be able to create your own shortcodes. Enjoy!</p> ]]></content:encoded> <wfw:commentRss>http://wptidbits.com/tutorials/save-time-using-wordpress-shortcodes/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Disable Comments and Pingbacks in Old Posts</title><link>http://wptidbits.com/tutorials/disable-comments-pingbacks-in-old-posts/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=disable-comments-pingbacks-in-old-posts</link> <comments>http://wptidbits.com/tutorials/disable-comments-pingbacks-in-old-posts/#comments</comments> <pubDate>Sun, 18 Jul 2010 17:58:56 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Tutorials]]></category> <category><![CDATA[comments]]></category> <category><![CDATA[hack]]></category><guid
isPermaLink="false">http://wptidbits.com/?p=593</guid> <description><![CDATA[Somehow after a period of long time, we still receiving comments and trackbacks for our old wordpress posts. This maybe troublesome for us to approve if it is require moderation and moreover if they are likely more to spams and hot-linking only. However, the is an easy hack where you can disable comments and trackbacks after a certain period the post was published. ]]></description> <content:encoded><![CDATA[<p>Somehow after a period of long time, we still receiving comments and trackbacks for our old wordpress posts. This maybe troublesome for us to approve if it is require moderation and moreover if they are likely more to spams and hot-linking only. However, the is an easy hack where you can disable comments and trackbacks after certain a period the post was published.</p><p>Simply open your wordpress theme&#8217;s <em><strong>functions.php</strong></em> using any of your favorite editor and add this code below:</p><pre class="brush: php">

&lt;?php
function close_comments( $posts ) {
if ( !is_single() ) { return $posts; }
if ( time() - strtotime( $posts[0]-&gt;post_date_gmt ) &gt; ( 30 * 24 * 60 * 60 ) ) {
$posts[0]-&gt;comment_status = &#039;closed&#039;;
$posts[0]-&gt;ping_status    = &#039;closed&#039;;
}
return $posts;
}
add_filter( &#039;the_posts&#039;, &#039;close_comments&#039; );
?&gt;
</pre><p>You can run this script as a plugin, through your theme’s <strong><em>functions.php</em></strong>, or through a custom <strong><em>user-functions.php</em></strong> file. Simply set the desired number of days by changing the number “<em><strong>30</strong></em>” to whatever you would like. As is, this script will close comments, pingbacks and trackbacks on all articles posted more than 30 days ago.</p> ]]></content:encoded> <wfw:commentRss>http://wptidbits.com/tutorials/disable-comments-pingbacks-in-old-posts/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Rounded Corners with CSS3</title><link>http://wptidbits.com/tutorials/rounded-corners-with-css3/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rounded-corners-with-css3</link> <comments>http://wptidbits.com/tutorials/rounded-corners-with-css3/#comments</comments> <pubDate>Thu, 15 Jul 2010 18:25:27 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Tutorials]]></category> <category><![CDATA[css]]></category><guid
isPermaLink="false">http://wptidbits.com/?p=584</guid> <description><![CDATA[Simply this is like the repetition of same technique used by many css coders out there. The real basic where it starts of how to apply rounded corners using css3. ]]></description> <content:encoded><![CDATA[<p>Simply this is like the repetition of same technique used by many css coders out there. The real basic where it starts of how to apply rounded corners using css3.</p><p>Since many years back, rounded corners has been major signature of design elements in Web 2.0 trend. Many css coder have been using rounded corner images to achieve this purpose. But since the page loading time, number of images used, dns lookups, minified css, javascripts and so many things has been counted for an &#8220;excellent&#8221; web 2.0 website, using css3 codes might be the life saver.</p><p>Using simple <span
style="color: #993300;"><strong><em>-webkit-border-radius</em></strong></span> or <span
style="color: #993300;"><em><strong>-khtml-border-radius</strong></em></span> properties, we can get rounded corners without using any image at all.</p><h3>Straight to the Point</h3><p>For example, code below will return 5 pixel border radius corner to all.</p><pre class="brush: css">

-moz-border-radius: 5px;
-khtml-border-radius: 5px;
-webkit-border-radius: 5px;
</pre><p>While this one will give only top corners rounded.</p><pre class="brush: css">

-moz-border-radius: 5px 5px 0px 0px;
-khtml-border-radius: 5px 5px 0px 0px;
-webkit-border-radius: 5px 5px 0px 0px;
</pre><p>It will look like image below:</p><p><img
class="alignnone size-full wp-image-587" title="5pxbox_example" src="http://wptidbits.com/wp-content/uploads/2010/07/5pxbox_example.gif" alt="" width="416" height="220" /></p><h3>Bad News</h3><p>The bad news is that not all browsers can support this feature. You can try view demo below in different browsers to see it live or follow<a
title="Muddledramblings.com" href="http://muddledramblings.com/table-of-css3-border-radius-compliance" target="_self"> this useful site</a> that states a complete table on the browsers compatibility. Read more <a
title="border-radius-property" href="http://www.w3.org/TR/2005/WD-css3-background-20050216/#the-border-radius" target="_self">why it is so</a>.</p><p>Use the downloaded file below for testing. Open it using you favorite css editor and keep different combination. Of course it is very simple. But, why not strengthen it? Have fun!</p><h3>See it or Have it</h3><div
id="viewdownloads"><ul><li
class="r_view"><a
title="View" rel="bookmark" href="http://wptidbits.com/demos/rounded-corners/">View<span>See the example in action..</span></a></li><li
class="r_down"><a
title="Download" rel="bookmark" href="http://wptidbits.com/wp-content/uploads/2010/07/rounded-corners-css3.zip">Download<span>Keep it for your reference..</span></a></li></ul></div> ]]></content:encoded> <wfw:commentRss>http://wptidbits.com/tutorials/rounded-corners-with-css3/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>How to Override the Page or Slug Permalinks in WordPress</title><link>http://wptidbits.com/tutorials/override-page-slug-permalinks-wordpress/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=override-page-slug-permalinks-wordpress</link> <comments>http://wptidbits.com/tutorials/override-page-slug-permalinks-wordpress/#comments</comments> <pubDate>Thu, 08 Jul 2010 17:06:41 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Tutorials]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://wptidbits.com/?p=544</guid> <description><![CDATA[Permalink or slug is one of the most important entity of search engine's 'main food' which they will prioritize and then index it for searching. A good slug or permalink may bring more visibility to search engines and that is what we already know about. But sometime we may facing trouble in updating permalink or slug, even after we delete the page or post in Wordpress. Let see how we can fix this..]]></description> <content:encoded><![CDATA[<p>Permalink or slug is one of the most important entity of search engine&#8217;s &#8216;main food&#8217; which they will prioritize and then index it for searching. A good slug or permalink may bring more visibility to search engines and that is what we already know about. But sometime we may had trouble in updating permalink or slug, even after we delete the page or post in WordPress. Let see how we can fix this..</p><h3>The Problem</h3><ul><li>Let say we have created a page, named for example <em><strong>About</strong></em> (slug also named <em><strong>about</strong></em>). Suddenly we change our mind and delete it.</li><li>After sometime, we decided that we saw the necessity of the page and recreate a page with the same name and slug.</li><li>However, the result returned name <strong>About</strong> but the slug became <strong>about-2</strong>. Even after several time editing and renaming (even deleting also), still return the same value.</li></ul><p>Have you ever faced something like this?</p><h3>The Solution</h3><p>I know the solution is quite easy for most people especially those who are wordpress savvy. <img
src='http://wptidbits.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> This is quite useful for newbie like me..</p><ul><li>Go to your wordpress Pages menu, you will surely find something like &#8216;<em><strong>All</strong></em>&#8216;, &#8216;<em><strong>Published</strong></em>&#8216;, &#8216;<em><strong>Draft</strong></em>&#8216; (if you have draft saved) and &#8216;<em><strong>Trash</strong></em>&#8216;.</li></ul><p><img
class="alignnone size-full wp-image-550" title="trash" src="http://wptidbits.com/wp-content/uploads/2010/07/trash.gif" alt="" width="445" height="281" /></p><ul><li>The solution is in &#8216;<em><strong>Trash</strong></em>&#8216;. Click it and you will see the original <em><strong>about</strong></em> slug and permalink. This is all where your deleted pages will go into.</li><li>Hover onto it, select and click &#8216;Delete permanently&#8217;.</li></ul><p><img
class="alignnone size-full wp-image-551" title="delete_trash" src="http://wptidbits.com/wp-content/uploads/2010/07/delete_trash.gif" alt="" width="554" height="235" /></p><ul><li>Now, you can create or edit the un-edited slug <em><strong>about-2 </strong></em>page into <em><strong>about</strong></em> page.</li></ul><p>Problem fixed! Enjoy!</p> ]]></content:encoded> <wfw:commentRss>http://wptidbits.com/tutorials/override-page-slug-permalinks-wordpress/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Display Multiple Ads After Any Post Number</title><link>http://wptidbits.com/tutorials/display-multiple-ads-after-any-post-number/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=display-multiple-ads-after-any-post-number</link> <comments>http://wptidbits.com/tutorials/display-multiple-ads-after-any-post-number/#comments</comments> <pubDate>Wed, 07 Jul 2010 18:09:57 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Tutorials]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://wptidbits.com/?p=540</guid> <description><![CDATA[Sometime we may need to add an advertisement or adsense ads after our first post. That is quite easy to do. However, how if we want to add multiple advertisements after certain number of posts? See how it can be done..]]></description> <content:encoded><![CDATA[<p>Sometime we may need to add an advertisement or adsense ads after our first post. That is quite easy to do. However, how if we want to add multiple advertisements after certain number of posts? See how it can be done..</p><ul><li>First open your themes <em><strong>index.php</strong></em> file using any of your favorite editor.</li><li>Find the following code of line:</li></ul><pre class="brush: php">

&lt;?php if(have_posts()) : ?&gt;
</pre><ul><li>Copy the code below and paste it before the above code.</li></ul><pre class="brush: php">

&lt;?php
$postnum = 1;
$showads1 = 1;
$showads2 = 2;
?&gt;
</pre><ul><li>Scroll more down the <em><strong>index.php</strong></em> page and find the following the code of line:</li></ul><pre class="brush: php">

&lt;?php endwhile; ?&gt;
</pre><ul><li>Same procedure, copy and paste the code below before the code above.</li></ul><pre class="brush: php">

&lt;!--Ads Code Start Here--!&gt;
&lt;?php if ($postnum == $showads1) { include (TEMPLATEPATH . &#039;/ads1.php&#039;); } ?&gt;
&lt;?php if ($postnum == $showads2) { include (TEMPLATEPATH . &#039;/ads2.php&#039;); } ?&gt;
&lt;?php $postnum++; ?&gt;
&lt;!--Ads Code End Here--!&gt;
</pre><ul><li>Finally, create two files named as <strong><em>ads1.php</em></strong> and <em><strong>ads2.php</strong></em> and paste any advertisement code into both the files. Not only advertisement actually. You can try to insert anything, really.</li><li>Make sure to put both files into the same directory as the <em><strong>index.php</strong></em> file.</li></ul><p>The code above will display ads after the first and second post. By changing the <em><strong>$showads1=1</strong></em> and <strong>$showads2=2</strong> number into &#8220;<em><strong>2</strong></em>&#8221; or &#8220;<em><strong>3</strong></em>&#8221; will give different position of advertisement. Try with different combination to get anywhere you want the ads to appear.</p><p>Best example is that you can see after my first post, there are two rows of section (<strong>popular posts</strong> and <strong>subscription section</strong>).</p><p>Now, enjoy!</p> ]]></content:encoded> <wfw:commentRss>http://wptidbits.com/tutorials/display-multiple-ads-after-any-post-number/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Customize WordPress Login Logo With Your Own Logo</title><link>http://wptidbits.com/tutorials/customize-wordpress-login-logo-with-your-own-logo/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=customize-wordpress-login-logo-with-your-own-logo</link> <comments>http://wptidbits.com/tutorials/customize-wordpress-login-logo-with-your-own-logo/#comments</comments> <pubDate>Tue, 06 Jul 2010 13:00:00 +0000</pubDate> <dc:creator>admin</dc:creator> <category><![CDATA[Tutorials]]></category> <category><![CDATA[hack]]></category> <category><![CDATA[wordpress]]></category><guid
isPermaLink="false">http://wptidbits.com/?p=535</guid> <description><![CDATA[At login page into Wordpress admin, we may see same default wordpress logo. This may be boring for some people. Using different logo can give added value and expressing the identity of certain website, while it may means nothing at all. Anyway, in order to customize wordpress login page logo into your own logo can be achieve in two ways.]]></description> <content:encoded><![CDATA[<p>At login page into WordPress admin, we may see same default wordpress logo. This may be boring for some people. Using different logo can give added value and expressing the identity of certain website, while it may means nothing at all. Anyway, in order to customize wordpress login page logo into your own logo can be achieve in two ways.</p><h4>Using functions.php modification</h4><ul><li>Simply find and add this code below into your theme&#8217;s <em><strong>functions.php</strong></em> file.</li></ul><pre class="brush: php">

//Custom Login Logo
function my_custom_login_logo() {
echo &#039;&lt;style type=&quot;text/css&quot;&gt;
h1 a { background-image:url(&#039;.get_bloginfo(&#039;template_directory&#039;).&#039;/images/custom-logo.png) !important; }
&lt;/style&gt;&#039;;
}
add_action(&#039;login_head&#039;, &#039;my_custom_login_logo&#039;);
</pre><p><img
class="alignnone size-full wp-image-537" title="login-page-image" src="http://wptidbits.com/wp-content/uploads/2010/07/login-page-image.gif" alt="" width="364" height="352" /></p><ul><li>Create your own logo not exceed than 250pixels x 68pixels and upload into your theme&#8217;s images directory.</li><li>By default, the logo url link is linked to <em><strong>http://wordpress.org/. </strong></em>To change the url to your homepage, just add this another piece of code under the code above.</li></ul><pre class="brush: php">

//Custom Login Url
function change_wp_login_url() {
echo bloginfo(&#039;url&#039;);
}
function change_wp_login_title() {
echo get_option(&#039;blogname&#039;);
}
add_filter(&#039;login_headerurl&#039;, &#039;change_wp_login_url&#039;);
add_filter(&#039;login_headertitle&#039;, &#039;change_wp_login_title&#039;);
</pre><h4>Using WordPress Plugins</h4><ul><li>You may use wordpress plugins such as <a
title="Theme My Login" href="http://wordpress.org/extend/plugins/theme-my-login/" target="_blank">Theme My Login</a> plugin. Follow the link and see how to use it.</li></ul><p>The code originally found on <a
title="WPRecipes" href="http://www.wprecipes.com/" target="_self">WPRecipes</a> and written by <a
title="WPTricks" href="http://www.wp-tricks.co.il/%d7%9c%d7%95%d7%92%d7%95-%d7%9e%d7%95%d7%aa%d7%90%d7%9d-%d7%90%d7%99%d7%a9%d7%99%d7%aa-%d7%91%d7%a2%d7%9e%d7%95%d7%93-%d7%94%d7%94%d7%aa%d7%97%d7%91%d7%a8%d7%95%d7%aa/" target="_self">Rami</a>. Great guys!</p> ]]></content:encoded> <wfw:commentRss>http://wptidbits.com/tutorials/customize-wordpress-login-logo-with-your-own-logo/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (user agent is rejected)
Database Caching 7/16 queries in 0.013 seconds using disk

Served from: wptidbits.com @ 2010-09-08 03:54:49 -->