WordPress.org

Ready to get started?Download WordPress

Forums

Getting a vertical bar or divider into my cool, auto-generated horizontal menu (9 posts)

  1. jennybeaumont
    Member
    Posted 3 years ago #

    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!?

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Try using CSS?

  3. jennybeaumont
    Member
    Posted 3 years ago #

    Gee, thanks :P

    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. :)

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    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.

  5. jennybeaumont
    Member
    Posted 3 years ago #

    Sweet, thanks esmi, will give it a go :)

  6. jennybeaumont
    Member
    Posted 3 years ago #

    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!

  7. esmi
    Forum Moderator
    Posted 3 years ago #

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

  8. esmi
    Forum Moderator
    Posted 3 years ago #

  9. jennybeaumont
    Member
    Posted 3 years ago #

    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>');
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic