WordPress.org

Support

Support » Themes and Templates » Getting a vertical bar or divider into my cool, auto-generated horizontal menu

Getting a vertical bar or divider into my cool, auto-generated horizontal menu

  • I’ve looked around quite a bit, and haven’t found any discussion on the matter. In fact, when I check other WordPress templates, it seems like people are either manually inserting horizontal nav bars to insert cool • or | dividers between the links, or they’re simply leaving the list with no dividers at all.

    I want both! I want automatically generated menus (in or outside a widget), with cool dividers (without that extra one at the end!). I cannot for the life of me figure it out.

    Help!?

Viewing 8 replies - 1 through 8 (of 8 total)
  • esmi

    @esmi

    Forum Moderator

    Try using CSS?

    Gee, thanks 😛

    Yes, the issue is not whether or not to use CSS, as that is obviously the solution. What I’m having trouble with is how to wrap the CSS around the ul li tags (without touching any core WP files) so that i can apply the style to all but the last item in the list. ‘Cause a bar or divider at the end of a list is kinda dumb, agreed?

    Thanks again. 🙂

    esmi

    @esmi

    Forum Moderator

    Have a look at the pseudo :before and :after classes. The trick is to apply a left or right border to all of the links and then remove on the last (or first) link as appropriate.

    Sweet, thanks esmi, will give it a go 🙂

    So, not to be a bother, but you could be more specific? Because these classes aren’t native to the menus if I’m not mistaken. Do I need to create a special function or something? How do I define the class (not in my CSS, but so that the style is applied where it needs to be)?

    Thanks!

    esmi

    @esmi

    Forum Moderator

    You can just add these classes to your stylesheet for your menu.

    esmi

    @esmi

    Forum Moderator

    hmmm, i still don’t see how this can help me identify the end of my list. i’m looking for something like this, but that work on menus:

    <?php $tag_list = get_the_tag_list( $before = 'before', $sep = 'seperator', $after = 'after' ) ?>

    OR

    <?php
    if(get_the_tag_list()) {
     get_the_tag_list('<ul><li>','</li><li>','</li></ul>');
    }
    ?>
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Getting a vertical bar or divider into my cool, auto-generated horizontal menu’ is closed to new replies.