keaglez

Filter get_terms to return only terms with published post

Posted on Programming, Wordpress and tagged with ,

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.

Read more…

Some useful tips for WordPress custom post type and taxonomy

Posted on Programming, Wordpress and tagged with ,

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.

Read more…

July Promotion on PSD to XHTML service

Posted on Service and tagged with , , , ,

Recently I try my luck on offering service for PSD to XHTML and CSS conversion on Kaskus, the biggest local forum in Indonesia. I have done many PSD to XHTML and CSS conversion before, often, I also do conversion to WordPress and Magento. While I want to list my previous work here, unfortunately, due to the contract, I’m not permitted to list them. So basically, you can see how well my blog markup is for an example of my work. :)

Details for my service can be found here. For international user, you can just contact me for a quote.

For this service, I will offer a promotion every month. For July, you will get a limited offer for a free PSD to XHTML and CSS conversion, only for 1 person. The following condition is apply for this promotion:

  • You must agree and give me permission to list the work on my portfolio page and Kaskus (with a clear position of me as the PSD to XHTML and CSS converter, the design is still yours of course, no worries :) )
  • Turn around is in a week (I’ll work on it when I have time, but I’ll make sure it completed in a week)
  • Only for 1 page (additional page will be charged with normal price)
  • I will choose the design that sent to me
  • Only for client that haven’t working with me before (sorry for returning client :) )

Deadline is August 1. Your design will be converted to XHTML and CSS in a week after the deadline.

Blog redesign

Posted on Designing, Programming, Wordpress and tagged with , , , , ,

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. :)

Read more…

Frustating WordPress Database Error

Posted on Wordpress and tagged with ,

Have you ever got this error? While this happens, you must make sure you have configured your wp-config.php. Check for these line:

define(‘DB_NAME’, ‘putyourdbnamehere’);

/** MySQL database username */
define(‘DB_USER’, ‘usernamehere’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘yourpasswordhere’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

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.

Proudly powered by Wordpress