Support » Themes and Templates » Categories

  • Hi,
    I try to develop an own style for the WP 2.1 Version and want to show all main categories as a kind of menu. The result should look like this:

    Category 1 | Category 2 | Category 3 | Category 4

    But i don’t want to display the subcategories… wich function I have to use? and how i have to use it?

Viewing 5 replies - 1 through 5 (of 5 total)
  • If you plan to design for WP you better get familiar with these:
    http://codex.wordpress.org/Template_Tags
    http://codex.wordpress.org/Stepping_Into_Template_Tags

    Also, keep in mind that in WP 2.1. the whole category system went through a major overhaul, so check and re-check everything in those articles!

    Tanks, i already read this arcticles and i tried to use the “wp_list_categories” funcion. But i always got all categories of my blog, they ware sorted with the <li> Tag, what I dont want to have… i just need the names and links or IDs of my main categories, why is it so hart to find a solution for this simple problem with WP?

    Well, if you want to “design” then let’s get back to the basics.
    1. Define precisely WHERE do you want to display that category list: sidebar? top horizontal menu? or what?

    2. Don’t worry about the <li> tags – you have a stylesheet where you can define the behaviour of every list. That’s where the design starts…

    Try to learn about how to style lists:
    http://css.maxdesign.com.au/listamatic/

    Thanks for the hind, my CSS skills are okay, so the design is no problem. But my primary pain is trying to get the parent categories (i want them for a top horizontal menu). At the moment I try to get them with a custom mysql query.

    I hope you understand my bad english now 😉

    Okay I just got it! Bik thanks for your help moshu. For all those who have the same problem, here is the solution:

    $MainCats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories WHERE category_parent = '0'");
    foreach ($MainCats as $MainCat) {
    The Code
    }

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Categories’ is closed to new replies.