• Hello, seems i got little problem. Since i have over 30 categories on my site i want to use collapsible menu for them to make navigation easier. I’ll do it in a manner as descrided on Wiki (https://wiki.www.ads-software.com/Tabbed%20Sidebar). But in that example user has to add menu items manually. Is there a way to get conetnt for menus using WordPress internal functions?

Viewing 11 replies - 16 through 26 (of 26 total)
  • Anonymous User

    (@anonymized-3085)

    I’m working on it! but I don’t know php so it’s going to take a while ??
    heres my thoughts, hopefully some of it makes sense:
    It would mean amending how <?php wp_list_cats(); ?> works…
    Each category is allocated an ID, with category parent as 0
    each sub category has a category parent ID other than 0.
    By utilising this information it should be possible to allocate/autogenerate an id, or a class, to a category li tag. Preferably related to the current ID, so using the ID number might be useful.
    In the main stylesheet, or an autogenerated additional sheet, you a add ul.children { display:none;}
    which will hide all sub categories.
    In the template you add some css to the header:

    #ID.children{display:block}
    where ID is also autogenerated and relates to the current viewed category ID <strong>or</strong> category_parent
    so if you were looking at a category entitled 'About' with an ID of 10 which had a sub category entitled 'Access' with an  ID 11. The generated markup would look like this:
    <br />
    <li id="categories">Categories:
    <ul>
     <li class="one"><a href="".../index.php?cat=1"" title=""All">Main</a> </li>
    <br />
     <li class="ten"><a href="".../index.php?cat=10"" title=""About">About</a><br />
              <ul class='children'></p>
    <li><a href="".../index.php?cat=11"" title=""Accessible">Accessible</a></li>
    
              </ul>
    
    </li>
    <br />

    the main style would have:
    one.children, ten.children{display:none;}
    the inserted css generated on the template would have the following, when viewing the relevant page:
    ten.children{display:block;}
    Is that as clear as mud? I’m hoping it isn’t and that conveys my thoughts on this.

    so u dont get to see quicktag bar while posting. pretty cool…

    I get how the CSS is set up initialy…..OK…. maybe I don’t get it…. hang on, I thing we are on different pages of the same book.
    OK, let’s say I hit your site, come right into the main page.
    If I were to see the category links, and click on one that had sub cats…. what would happen?
    1) The page refreshes top display that category, and the menu would then “expand” to show the sub cats?
    2) The page doesn’t refresh and the sub cats “slide” out (like a tree view does in Windows File Exporer)
    3) ?? Something I didn’t think of ???
    TG

    take a look at my website (https://www.taijiquan.pro.br), is this what you want? It is CSS only, but doesn’t work on IE (so i had to set up a “links” page).

    I cant seem to get it to work sushubh ??
    I know I’m doing it wrong, could you help me please?
    I did this part:
    1. Copy, paste and save into listCollapse.js file the script listed at the end of
    https://www.howtocreate.co.uk/jslibs/htmlhigh/listCollapse.html Then uploas .js file to you wp root folder.
    2. Put in your template after <body> tag following script:
    <script type=”text/javascript” language=”javascript1.2″ src=”listCollapse.js”></script>
    <script type=”text/javascript” language=”javascript1.2″></script>
    https://www.ctfzone.net

    Actually found something which took a bit more work on my part as far as the links go, but was well worth it.
    https://gemal.dk/util/
    1- basically edited the images locations in the tread.js with textpad, upload it the your wp root:
    { node.childNodes.item(0).src = "pics/menu_minus.gif";
    2- then make your menu links page in textpad(name it links.php or something) by coping the source code from the site (i/e from the test section you like to style after- I did test 3, but renamed it to id01):

    <img src="pics/menu_plus.gif" alt="+" width="13" height="13" />
    Leagues

    <div id="id01" style="display:none">
    &nbsp;&nbsp;&nbsp;<img src="pics/menu_item.gif" alt="item" width="13" height="13" />
    CTFDL
    &nbsp;&nbsp;&nbsp;<img src="pics/menu_item.gif" alt="item" width="13" height="13" />
    The OGL
    &nbsp;&nbsp;&nbsp;<img src="pics/menu_item.gif" alt="item" width="13" height="13" />
    Team Warfare

    3- put <script type="text/javascript" src="thread.js"></script> in between your head tags.
    4- include your new links page in your template where you want it:
    <?php include("https://www.yoursite.net/wpdir/linkpage.php"); ?>
    5- right click and “save as” the + & – & block item pics from the site and upload them to your site where you made the path(the path for the images is in both the thread.js and the links.php, in this example the pics directory)
    site back and say ah.

    lol, i figured out why the other menu one wasn’t working- try not to laugh to hard. I have my wp in dif directory but forgot to edit the right index. I woulda saved myself mucho work, but awell I’m happy with the result.

    TechGnome,
    I think elfin is working towards something completely different than the original request of this thread. Elfin appears to be setting up a style so that the front page (index) shows the parent categories and hides the child categories but when you click on a parent category link, the category archive page retrieved would display the child categories.
    Elfin, I think you’re confused with what the original poster in this thread wanted. He was looking for something that will slide out the child categories when you click or hover over the parent category while still on the same page.

    Anonymous User

    (@anonymized-3085)

    quite probably junesix…

    Anonymous User

    (@anonymized-3085)

    I’ve been able to hack some bits together for the solution I was looking for, ahve a look at:
    Expanding sub category menu via css

    junesix – yeah, I got that after my last post. Which is how I came to be confused how he was doing it all in CSS w/o javascript.
    TG

Viewing 11 replies - 16 through 26 (of 26 total)
  • The topic ‘Collapsible category list?’ is closed to new replies.