WordPress - Creating Custom Post Type Without Title

It is very easy to create a new post type in WordPress, you just need to call the register_post_type() function with all of it's configuration array and the post type will be visible and ready for use.

But if you choose not to utilize the default "title" in the register_post_type() arguments then most likely all of the newly created post under the custom post type will be give "auto-draft-xxx" as it's post title and post name.

jQuery - Loading and unloading CSS script dynamically

Why to do this?

It may be a strange to hear when someone wanted to load a CSS file dynamically or even try to unload it.

Sure you can use jQuery to style the elements by adding inline styling, and removing the inline style using jQuery is not hard to do either.

Wordpress - Limiting Media to owner only

Wordpress Media manager is a very good tools, but it was designed to act as media pools for all user in the site, sometimes we want to limit the media displayed in Media uploader to show only the media that current user actually owned.

In that case we will need to add a filter to wordpress query, an additional sql query limit that will limit the searched data for media file owner only.

We can add a new filter by invoking the filter 'parse_query' like this :

Wordpress - Registering Custom Taxonomy Programmatically

It is possible to register custom taxonomy in wordpress programmatically by utilizing the register_taxonomy() function, it can be done from widgets, theme or plugins.

The key is to invoke the function in wordpress init hook, so it the custom taxonomy will be registered before other function that may call or use it later on.

Sample of hooking into wordpress init hook :

Drupal 7 - Domain Access Custom Metatags per domain

You can easily code in a metatag to display on certain domain only when use domain access module. Valid example for this is when you have a multiple domain installed on the same directory and utilizing domain modules to switch between different domain, and you don't want Google or any search engine robot to crawl some domain.

You may argue that this can be done via robot.txt, and for multiple domain some fancy .htaccess rule with redirection to different robot.txt files for each of the domains respectively. The answer is yes, you can achieve the same results with this way too.

Drupal 7 - How to quickly bulk delete unapproved comments

After neglecting one of my websites for a couple month, I decided to do some maintaining and logged in to the site as admin. To my surprise, eventhough the site is "Protected" by mollom as spam protector, I got 132.149 unapproved SPAM comments.

Drupal 7 form missing include files

Sometimes when building an advanced Drupal form that involves form_alter plus including files you will encounters problems that Drupal is complaining about a missing functions that is in your include file.

This problem usualy happen if your form submit function utilizes $form_state['rebuild'] = TRUE or invoked via ajax. Drupal form system is smart enough to auto load all of your include files if you call it using module_load_include() function, or form_load_include() function.