• I’m try to add a ” / ” between my menu bar buttons by using the link_after parameter in wp_list_pages

    my code is as follows:

    <?php wp_list_pages('depth=1&title_li=&link_after=<span class="clearstick">&nbsp;/&nbsp;</span>'); ?>

    but is does not work.

    How can I have it so the dash and the space either side appears after each menu item?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The link_before and link_after parameters add your characters within open and closing anchor markup. If you want something to appear between the links, the best method is to just use:

    <ul class="menu pages">
    <?php wp_list_pages('depth=1&title_li='); ?>
    </ul>

    in your template and then use CSS to add the ‘ – ‘ as a graphical list bullet image. Something like:

    ul.menu {
    margin:0;
    padding:0;
    }
    .menu li {
    float:left;
    list-style-image:url(images/separator.gif);
    margin:0;
    padding:0;
    }
    #menu li a {
    padding:0 3px;
    }
    Thread Starter miocene22

    (@miocene22)

    That would work but then I’d have a \ at the first item too.

    As it is I am using jquery to omit the last slash.

    I don’t mind the slash being part of the anchor; I have used css to stop it changing when hovered.

    See here

    I just need to get the space after the slash to render.

    Thread Starter miocene22

    (@miocene22)

    anyone??

    miocene22 you “&” are messing you up. Anytime you add an ampersand, you call on a different wordpress attribute. Try using spaces to replace your &nbsp or use a back slash to null your call or perhaps use quotes or “.” to execute your &nbsp. I don’t have that particular problem, but I am absolutely certain that your “&” is messing you up. Try your original code without the &nbsp to check if I’m right. Good luck! I hope this response helped you out a bit.

    I just checked it out, the fact that you want two &nbsp may be an issue, but you can achieve 1 space if you use the “%20” code. The “/” that you want to add is being directly added to your links, so keep that in mind.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘wp_list_pages – link_after use a html space’ is closed to new replies.