WordPress.org

Ready to get started?Download WordPress

Forums

Show this category's posts in menu (1 post)

  1. dabhandconz
    Member
    Posted 1 year ago #

    So I have a vertical UL menu which goes like this:

    CATEGORY 1
    CATEGORY 2
    CATEGORY 3
    CATEGORY 4
    CATEGORY 5
    CATEGORY 6

    What I want is when you click a Category and go to a page, the Category Posts are listed in the menu as a sub list with different styling (and thus class) than the parent, like this:

    CATEGORY 1
    CATEGORY 2
    Post 1
    Post 2
    Post 3
    CATEGORY 3
    CATEGORY 4
    CATEGORY 5
    CATEGORY 6

    So in HTML my code would look something like this:

    <ul class="parent">
      <li>CATEGORY 1</li>
      <li class="this_category">CATEGORY 2
         <ul class="child">
           <li>Post 1</li>
           <li>Post 2</li>
           <li>Post 3</li>
        </ul>
      <li>CATEGORY 3</li>
      <li>CATEGORY 4</li>
      <li>CATEGORY 5</li>
      <li>CATEGORY 6</li>
    </ul>

    I can not for the life of me figure out how to pull a list of "this category's" Posts and insert them as a sub list in the menu though, nor can I find the answer even though I'm sure it's out there.

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic