It has been a while since the last time I change the design of this blog, it is almost three years ago. The web landscape has been changed rapidly since then, with HTML5 becoming more standard and CSS3 is more supported, that made my old design outdated. So the thought came to me, it is the time for a new design.
Also with this opportunity, I also introduced a new domain for this blog, jeffri.me. Starting today, jeffri.me is the default domain for this blog, while my old domain – jeffri.net – will redirect to this new domain. In case you are wondering, why did I change a dot net to dot me, well, no specific reason. I just feel like it, it’s shorter by one letter and it’s more personal. 🙂 Besides, it’s not like my old domain ranked high, although it’s 5 years old now. I will keep jeffri.net for as long as I live though.
One of my developer friend asked me if we could sort by last post using wp_list_categories function for WordPress. By default, wp_list_categories accept arguments for order by ID, name, slug, count or term_group. Order by latest post is not possible by default, but with a little of tweak using filter hook, we can. 🙂
First, we’ll looking at the function wp_list_categories. This function made call to get_categories to get the list of categories, which made another call to get_terms. Categories in WordPress is basically terms with category taxonomy. Finally, looking on the get_terms function, we will find some delicious filter hook that suitable for our customization.
Well, this will be a short list of WordPress snippets that we could use. This snippets is collected from my daily work on WordPress and should be useful for daily basis.
WordPress mail snippets
WordPress has its own improved function for sending email, it is wp_mail. We should always use this function if we wanted to send email within WordPress. With this function, we don’t need to worry much about the mail header and stuff. More over, there is plenty of filter we can use to customize it.
WordPress has been long capable on using custom post type. Since WordPress 3.0, we are now easier to create a custom post type. I have blogged some tips about it.
However, many didn’t know that the custom post type already had it’s own landing page, though, you will need to pass the post type variable to the URL. This post will guide you to the step by step on customizing the post type landing page, as well as adding a new rewrite rule for a cleaner URL.
So you are using custom taxonomy. You add terms to the taxonomy, and add the terms to your posts. Then, you use get_terms and list all your terms. Everything works fine, terms that doesn’t have any posts will not be returned if you set hide_empty argument to true. Now you move some of your posts to draft and you get a problem. Terms that doesn’t have any published posts still returned. This lead to 404 error when you click on the link of this term. It doesn’t look good now, we need to remove term that doesn’t have any published post.
So how to do that? The answer is by using WordPress filter. This piece of code below will solve the problem.
Custom post type is one of the most powerful WordPress feature. It allows us to create just any content we need, combined with custom taxonomy, the possibility is just endless. WordPress have allowed to have custom post type and taxonomy for some while, but with WordPress 3, everything is far more easier. We have register_post_type and register_taxonomy created specifically for this purpose.
While this two combined to be a wonderful addition for your WordPress blog, there is still a lot of things that is not yet documented. Here is a few useful tips I collected when working with custom post type and taxonomy.
Welcome to my new redesigned blog! It’s been a year and a half since the last time I changed the design. I have always wanted to change it, but I just always don’t have enough time. 🙂 I know I’m not that good enough in designing, but at least, this is the best design I ever made until now!
The idea behind this design is, to make a simple, usable layout and still looks beautiful. There is a lot of tutorial on the web that helped me when making this. I try to make the website small in size, so you’ll able to load it fast enough. There is also a cool trick on the background, which still make the markup small without much wrapping div over div to accomplish the effect. I also realize the importance on social networking nowadays, so I add links to some of my account. 🙂
Have you ever got this error? While this happens, you must make sure you have configured your wp-config.php. Check for these line:
/** MySQL database username */
/** MySQL database password */
/** MySQL hostname */
Above is taken from wp-config-sample.php file. As long as you have configured the DB_NAME, DB_USER and DB_PASSWORD correctly, you should be fine. Some host might use a different DB_HOST, but mostly worked fine with localhost.
Well, if it does configured correctly and there still the same error happen, you might need to check the wp_options table.
Open the wp_options table using PHPMyAdmin or other similar software. Find the value siteurl in column option_name, if you see the option_value get a blank value like below:
Then you are probably on right track. Edit this row and insert your domain full URL in the option_value. Save.
Hopefully the error will go away. I don’t know why this could happen, but it did happen in one of my client website… 🙂 It’s indeed frustating to look for this error, since WordPress didn’t give any specific information about it.
If you found another cause of this error, please share.
This problem encountered since I moved my server to IIX, which has less bandwidth for international user, and for that reason too, the downstream is too small to download whole WordPress package that used for updating. That’s why, I always get timeout error. So, I’m simply unable to automatically update my WordPress.
However, the solution is actually simple, by increasing the timeout so the download can be completed. Once it is, the updating will going smoothly. So this is how to do it, in manual way.. 🙂