WordPress Permalink Settings on Windows Hosting

My 2 cents: You should not host WordPress (or any script other than ASP, .NET) on Windows hosting. Try Linux. You will not be disappointed. In case you still want to use Windows hosting for your WordPress, here is a piece of code that will save you lots of time trying to figure out how to update Permalink Settings on WordPress. You will probably got this message: You should update your web.config now. Open FTP and put the following into web.config file (create a new one if you can’t see it) <?xml version=”1.0″ encoding=”UTF-8″?> <configuration> <system.webServer> <rewrite> <rules> <rule name=”wordpress” patternSyntax=”Wildcard”> <match url=”*”/> <conditions> <add input=”{REQUEST_FILENAME}” matchType=”IsFile” negate=”true”/> <add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” negate=”true”/> </conditions> <action type=”Rewrite” url=”index.php”/> </rule></rules> </rewrite> </system.webServer> </configuration> That’s it. You’re welcome.

Markdown is available for self-hosted WordPress through Jetpack

Jay! I’ve just noticed that. It’s funny when searching for Markdown on WordPress return this article: Write (More) Effortlessly With Markdown Basically, they mentioned that Markdown is only available for WordPress.com blog, by a simple switch in configuration. I am skeptical, so I always try to use “official” version of plugins. Yes, there are many Markdown plugins out there http://wordpress.org/plugins/tags/markdown When I check my Jetpack version, it’s already there! So if you want to write in Markdown style (like Github and StackOverflow), just enable it (why not?).

Format post date in WordPress

We all know that $post->post_date will display post date in the following format: 2011-08-19 17:23:25. The problem is that, if we want to display post date in different format, what should we do? Fortunately, WordPress has a very useful function mysql2date. Suppose you want to display only Month and Year of the post, you should be able to do that using this snippet: < ?php echo mysql2date('F Y', $post->post_date) ?> The first parameter of this function can be referred in date function of php.net

How to count number of search results returned by WordPress

Suppose you want to create a custom search result for your theme. Apparently you will create a php script named search.php. One problem is that, you want to display total number of search results returned. Here is the solution for that. Searching for: < ?php echo get_search_query(); ?> < ?php $allsearch = &new WP_Query("s=" . get_search_query() . "&showposts=-1"); $count = $allsearch->post_count; ?> < ?=$count?> results found: Happy coding!