If you’re working on wordpress Theme, sometimes you need to know the categories ID for some categories. For example, in my cases, i need to exclude “projects” category from my blog posts lists, you can use query_posts(‘cat=-3) for example if you know that project assigned with category ID=3. But if your themes using by several sites, you will difficult to define the category ID, because it will be different on another wordpress installation.
You can use function get_cat_id(), You can use this function to take the category name get it’s ID number to use in functions like query_posts
above.
Example :
<?php
$id = get_cat_id('projects');
$q = "cat=" . $id;
query_posts('cat=-'.$q);
if (have_posts()) : while (have_posts()) : the_post();
the_content();
endwhile; endif;
?>























mantap kang salam kenal saja
ini yang dicari byme
byme