• Seiden

    (@seidenkaczka)


    Hello everyone,
    I’m looking to do an acordion menu using the wp_list_page code.
    Whenever I look on google for advices I only find loads of plugins, but that’s not what I’m looking for. I don’t want to use a plugin because I’m not using a created menu, I need to use the wp_list_pages, and I have no idea how to use CSS to make it an acordion. I tried the CSS given in the codex but it doesn’t do anything.
    So, unless there is a plugin that do page listing within an acordion, I rather need CSS advices….

    Here is exactly what I want:
    When I’m on a page, a side menu shows all of the pages that have the same upper-level parent.
    Like, if I’m on a page “C” that is child of “B” and “B” is child of “A”, then I want my menu to show every child (and grand-child) of “A”.
    But to make the menu smaller (because I have lots of pages) I want it do display only first level pages (direct child of “A”) and display children when I clic on an arrow beyond the parents’s link or I don’t know what.

    I use this to list my pages:
    ‘<?php
    if($post->post_parent)
    $children = wp_list_pages(“title_li=&child_of=”.$post->post_parent.”&echo=0″);
    else
    $children = wp_list_pages(“title_li=&child_of=”.$post->ID.”&echo=0″);
    if ($children) { ?>

      <?php echo $children; ?>

    <?php } ?>’
    Not sure if it’s the best code but as I don’t understand much about this I just copied a code for the codex….
    Now that I have my list of pages, how can I make them an acordion?

    Thanks a lot for any advice…

  • The topic ‘Acordion with wp_list_pages’ is closed to new replies.