• This is more of a “would be nice” thing than a support question, as I don’t expect a real solution to this.

    I’m using (sub)categories as a way to organize data in a current WP-as-database experiment of mine (this almost sounds like I know what I’m doing). There’ll never be posts in the parent categories, they just describe the child cats (“by author”, “by type” etc.). Like I said, experimenting.

    The support archives have helped me to at least display those empty-parent categories, and I experimented a little with the display: CSS parameter to then hide the parents (which only sort of worked).

    Now my question is if there’s any way to edit, for example, the template-functions-category.php to take out any <a href=""> wrappers around the parent list items only, so that those would function as “headers”, not links. I don’t know much about PHP, so I can’t answer the question myself.

Viewing 1 replies (of 1 total)
  • Thread Starter mumble

    (@mumble)

    Hmm, nevermind. I figured out a way to make it look close to what I wanted without touching the PHP code. Instead, I used CSS to achieve
    (1) more whitespace between category lists and between a category and its subcategories
    (2) the option to see the number of posts in a subcategory, but not in the parent categories (where the post count is always zero) and
    (3) a more header-like border for parents (instead of text-decoration:underline).

    I’ll just paste the code here (based on the default wp-layout.css for now) if anyone’s interested, I hope that’s okay.

    #menu ul ul li {
    border: 0;
    font: normal normal 70%/115% “Lucida Grande”, Verdana, sans-serif;
    letter-spacing: 0;
    margin-top: 2px;
    padding: 0 0 3px 12px;
    (2) color: #fff; /* same as menu background color */
    }

    #menu ul ul li a {
    color: #000;
    (3) border-bottom: 3px double #809080;
    (3) text-decoration: none;
    }

    #menu ul ul ul.children {
    font-size: 142%;
    padding-left: 4px;
    (1) margin-bottom: 20px;
    }

    #menu ul ul ul.children li {
    (2!) color: #809080;
    }

    #menu ul ul ul.children li a {
    text-decoration: none;
    (3!) border: none;
    }

    #menu ul ul ul.children li a:hover {
    text-decoration: underline;
    }

    (Oh, for the record, the category list is set up like this:
    wp_list_cats("children=TRUE
    &hide_empty=0
    &exclude=1
    &sort_column=name
    &optioncount=1")

Viewing 1 replies (of 1 total)
  • The topic ‘In wp_list_cats: parent categories as headings, not links?’ is closed to new replies.