Using in_category To Show Different Template For Different Category In WordPress
When developing sites under wordpress, we, sometime came across condition where we need to show different templates for a particular category/categories. For example, I have a client that need a particular template for his website that is based on wordpress. The site is about restaurant that he own. It has 3 type of posts, regular post for news & events, store items, and menu. For regular post, well, there should be no problem, but for menu, there are several custom fields in actions and the same for store items.
I can go using several if..else or switch(). But, that would produce a bulky single.php which, I try to avoid. There goes, until I found out the simple solution on codex, that is using in_category(). The page also teach me how to implement it smartly. The solution is rather simple. All you have to do is, create several php files which contain codes and add this code inside your single.php:
<?php get_header();
$recipeArrays = array(6,7,8,9,10);
$cateringArrays = array(12,13,14,15,16,17);
$menuArrays = array(18,19,20,21,22,23);
$storeArrays = array(25,26,27,28,29,30);
if(in_category($recipeArrays))
{
include('single_inner_recipe.php');
}
else if(in_category($cateringArrays))
{
include('single_inner_catering.php');
}
else if(in_category($menuArrays))
{
include('single_inner_menu.php');
}
else if(in_category($storeArrays))
{
include('single_inner_store.php');
}
get_footer(); ?>
That's it, now you have a more manageable codes.
Show/Hide Desktop Icons in XFCE
If you follow this blog, you should know that I had already posted an entry about this topic, but for gnome desktop.
Spying on your child’s computer
At their first experience with internet, children or teenagers tend to access porn content. The curiosity drive them to do that and then they'll enjoy it, do everything to watch it over and over again. Combine this with the facts that 15% of the children that accessed the internet, admit to chat with strangers. If we, as the parents, don't guide them pass this puberty, their next action can be so dangerous. There is no guarantee that strangers will lead them to the right way.
Computer spy might be a solution for the parents who worried about their children behaviour in the internet. There is a product that allows the parents to spy on their children computers discreetly. This product can record everything from websites visited until keystrokes. This product can capture screen shots without hardware. Once the Stealth iBot Computer Spy™ is plugged into your USB port, you can complete the installation just as fast as 5 second, then you can walk away. Just as simple as that. The user will never know that their action is recorded and logged. This computer spy tool works on any computers.
This computer spy tool is very good, because it is tricking most antispamming and antivirus programs, it also embeds itself directly into the Operating System. This computer spy tool will record keystrokes, capture screen shots regularly, record up to 10,000 screen shots. These data is encrypted strongly, so anyone cannot access it unless they have the key. This computer spy tool can works with XP, Vista and Vista Sp1.
PSA: Texting While Driving
See this video and THINK AGAIN before you texting while driving because that stupid thing you did, not only affect you, but the others party too!
Learn English, The Japanese Way!
Wow, it's been a year since my last video Friday! Anyway, It's back now. Please enjoy!
p>
Gmail Notes For Easy Annotation
Everyday I receive so many emails at office. At first, I can keep up with it, I can star it or move it to some labels I have. Also, add several notes on it on my tomboy. But, in the end, I got overwhelmed. Gmail's integrated task just don't cut it. Luckily, after googling several keywords, I got landed on this beautiful service called gmail notes. I want to develop some simple greasemonkey script, actually. But, why should I build one, when someone out there already made it and it's fulfil my needs?
. This service does what I want. Add annotations to each gmail conversation I have. It even worked on gmail hosted application *YAY!*





