Skip to main content

WP nav question 1111 Responses

Last post: 2 years, 7 months ago | Thread started: Oct 16, 09, 8:29 a.m.

RespondNew TopicDisable Images

  • jamble

    Styling it isn't a problem, I need a specific subnav class in order to get some jQuery niceness working as it targets the subnav class name specifically.

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earOct 16, 09, 8:33 a.m. – Permalink
  • taxiguerrilla

    Ah, ok, and you can't select objects with jQuery the same way?

    Anyway, I can't find it now, but there is a way to obtain the list of pages / subpages using a while {} loop. I'll make a search on my HD, if I find it I'll write you the snippet.

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earOct 16, 09, 8:35 a.m. – Permalink
  • taxiguerrilla

    Didn't find it on my HD, but found something that could help you:

    http://stackoverflow.com/questio…

    I think this way you should be able to nest 2 or more loops.

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earOct 16, 09, 8:40 a.m. – Permalink
  • jamble

    I'll keep looking, I'm not so hot on the jQuery either so I'm just trying to cobble something together. There must be a pretty straightforward way of doing it but WP's nav isn't the best.

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earOct 16, 09, 9:17 a.m. – Permalink
  • acescence

    a couple options, you can go into includes/post-template.php and edit the actual function. of course this will break if you upgrade. another option is to use a filter hook to process the output of wp_list_pages before it gets output to the template. another option is to copy the entire function and paste it in your template's functions.php file, then give it a unique name and edit the html it outputs.

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earOct 16, 09, 9:21 a.m. – Permalink
  • Stugoo

    if you need a hand with the jquery post up some code and what your tyring to do and ill see if i can help

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earOct 16, 09, 9:23 a.m. – Permalink
  • bulletfactory

    sometimes it's easier to do a hybrid of hardcode/dynamic.... example:

    <?php if (is_page('About') || is_page('Contact')) { ?>
    <ul class="subnav">
    <li><a href="<?php echo bloginfo('url'); ?>/whatever.pdf" title="link">link</a></li>
    </ul>
    <?php } ?>

    hope that helps.... and was what you were asking.

    • this would be in sidebar.php or wherever your nav sits. this entire code would also be surrounded by another list item (nested)bulletfactory
    + add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earOct 16, 09, 9:25 a.m. – Permalink
  • jamble

    Cheers folks,

    I can't really hardcode the nav as the pages will be updated/added to over time so the nav will grow / change a bit and I don't want the maintenence job.

    @Stugoo, I might be making a total balls of a simple job but I can't for the life of me get this (http://www.noupe.com/tutorial/d... dropdown nav to work because the .subnav class in the jQuery doesn't exist when WP generates the menu in the format in my original post.

    Sorry if it's not hugely clear,I'm developing locally so I don't have a link to show at the moment.

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earOct 16, 09, 9:30 a.m. – Permalink
  • bulletfactory

    note: i only meant to hardcode the <ul class="subnav"> and let the list items inside it be dynamic.
    it could grow as large as you want and be fine.

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earOct 16, 09, 9:33 a.m. – Permalink
  • acescence

    if you just want to do it with jquery..

    $("ul#nav ul").addClass("subnav");

    • You're a star, that's done the trick cheers.jamble
    + add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earOct 16, 09, 9:39 a.m. – Permalink

Login or Register to respond to this

Skip to main content