admin管理员组

文章数量:1122832

Basically I need a custom menu consisting of two level. Top level will consist of available categories, possibly with added feature that each category name is follow by the number of posts in that particular category, ie. Articles (37). The second or bottom level will consists of all unique tags relevant to that particular category. I'd very much like to visualize this, but I'm an idiot with this interface. No matter what I try to do, I seem to fail, so I'll do it the html way.

<ul id="menu">
    <li class="category">
        cat1
        <ul>
            <li class="tag">tag1</li>
            <li class="tag">tag2</li>
            <li class="tag">tag3</li>
        </ul>
    </li>
    <li class="category">
        cat2
        <ul>
            <li class="tag">tag3</li>
            <li class="tag">tag7</li>
            <li class="tag">tag14</li>
        </ul>
    </li>
    <li class="category">
        cat3    
        <ul>
            <li class="tag">tag2</li>
            <li class="tag">tag8</li>
            <li class="tag">tag14</li>
        </ul>
    </li>
<ul>

Of course each category and tags will be a link. Category links will list post it that specific category, just as we know it, however tag links will list post featuring the tag, but only those listed in the relevant category of course.

That pretty much sums it up I think.

I've tried on my own, but I'm going nowhere fast, so any help will be very much appreciated.

Best regards

Basically I need a custom menu consisting of two level. Top level will consist of available categories, possibly with added feature that each category name is follow by the number of posts in that particular category, ie. Articles (37). The second or bottom level will consists of all unique tags relevant to that particular category. I'd very much like to visualize this, but I'm an idiot with this interface. No matter what I try to do, I seem to fail, so I'll do it the html way.

<ul id="menu">
    <li class="category">
        cat1
        <ul>
            <li class="tag">tag1</li>
            <li class="tag">tag2</li>
            <li class="tag">tag3</li>
        </ul>
    </li>
    <li class="category">
        cat2
        <ul>
            <li class="tag">tag3</li>
            <li class="tag">tag7</li>
            <li class="tag">tag14</li>
        </ul>
    </li>
    <li class="category">
        cat3    
        <ul>
            <li class="tag">tag2</li>
            <li class="tag">tag8</li>
            <li class="tag">tag14</li>
        </ul>
    </li>
<ul>

Of course each category and tags will be a link. Category links will list post it that specific category, just as we know it, however tag links will list post featuring the tag, but only those listed in the relevant category of course.

That pretty much sums it up I think.

I've tried on my own, but I'm going nowhere fast, so any help will be very much appreciated.

Best regards

Share Improve this question asked Jul 28, 2011 at 18:43 ZacariazZacariaz 1011 bronze badge 2
  • Tags aren't specific to a category, they're specific to posts, the same with categories, there is no association between a tag and a category aside from when they're both assigned to the same post, the query you'd need won't be light. Perhaps something from this previous discussion will help. – t31os Commented Jul 28, 2011 at 19:19
  • Let say I write a post in category "tutorials" and add tags "Wordpress" and "CMS". The two tags will the appear in the "tutorials" sub menu. That don't mean that they are specific to that category. I may vary well write a post in another category using the same tags, same deal, only the links will work differently affectively listing posts in a specific category making use of a specific tag. – Zacariaz Commented Jul 28, 2011 at 19:48
Add a comment  | 

1 Answer 1

Reset to default 0

Are you familiar with the wp_nav menu?

You could achieve what you are asking using the wp-nav menu, but the categories, pages, etc. would have to be organized manually via the WordPress Menu Interface in the WP-Admin screen.

If you are OK with arranging them manually via drag-n-drop, let me know and I'll instruct you on adding this function to your theme.

本文标签: Custom menu with categories and tags