WordPress.org

Ready to get started?Download WordPress

Forums

Horizontal menu/submenu, not dropdown? (9 posts)

  1. guzh
    Member
    Posted 6 years ago #

    I've used this

    <div class="menu">
    	<ul>
    		<?php wp_list_pages('depth=1&sort_column=menu_order&title_li='); ?>
    	</ul><br />
    <?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) { ?>
    
    	<ul>
    		<?php echo $children; ?>
    		<?php } ?>
    	</ul>
    </div>

    The menu is horizontal, so is the submenu.
    I want the submenu to appair when clicking on the parent..
    if children, then load the submenu, if not just go to the parent page..
    I don't want a horizontal dropdown menu with a vertical listing of childrens, I want a horizontal menu with horizontal listing of childrens..

    Is this possible?
    Grid Focus has this function, but I have to edit my header.php each time I add a page.. I want it to be automatically done when I add a page in the admin panel.. A example of Grid Focus used is here. Click on the Archives-button to understand better what I want..

    I'm sure there is a way, but my PHP-skills isn't really good. So I'm not capable to do it on my own.. Thanks anyway (:

  2. Ryan Hellyer
    Member
    Posted 6 years ago #

    Yep, you can do that.

    The following code will display child pages even if you are on one of those child 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) { ?>
    <ul>
    <?php echo $children; ?>
    </ul>
    <?php } ?>

    Actually ... that looks exactly like what you have above. What is the question then? Your code seems to do exactly what you want already.

  3. guzh
    Member
    Posted 6 years ago #

    I want to display the submenu without actually _going_ to the parentpage before displaying the submenu.. Just with a mouse over or a click. just like a drop down menu, without the dropdown, kind of XD

    If you look at the example of Grid Focus (here is it - click on the "archives"-button) you'll understand better what I mean..
    If I do that with the codes above, I'll first load the Archive-page, before I can click on one of the children-links. I want to remain on the index-page (as with the Grid Focus-theme), and yet display the submenu.. If you understand what I mean..

    The only problem with Grid Focus is that I don't want to edit my header.php every time I add a page, or change a path or name or something..

    Hope you understand (:

  4. guzh
    Member
    Posted 6 years ago #

    no one? ;\

  5. Ryan Hellyer
    Member
    Posted 6 years ago #

    Adding a click makes things tricky.

    But you can modify a regular dropdown menu to display as a slider menu with dropdown sub-sub menus. I'm working on a CSS generator for this type of menu but it won't be ready for a while yet.

    They aren't too complicated to build if you know some CSS though and your way around the code for a suckerfish dropdown menu.

  6. guzh
    Member
    Posted 6 years ago #

    hum..

    Is it possible http://www.webspaceworks.com/resources/wordpress/30/ may work?
    It's vertical, but I guess it's possible to make it work with some edit to the CSS ;O

    I've tried a little but I didn't get it ;/

    anyway, thanks for the help, Ryan (:

  7. guzh
    Member
    Posted 6 years ago #

    *bump*

  8. roblgs
    Member
    Posted 6 years ago #

    Hi,

    The fold page list plugin generates an unordered list (or a whole set of nested unordered lists) and applies full styling of the page hierarchy and ancestry of the current page within those lists right back to the root.

    Changing the behaviour to allow for drop-downs, or from horizontal to vertical orientation is achieved through CSS, and perhaps a little unobtrusive javascript for the recalcitrant browsers that don't understand a full CSS vocabulary.

    Cheers

    Rob

  9. Mattz
    Member
    Posted 5 years ago #

    Have you been able to solve this ?

    PLease let us know.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.