• Resolved cboakes

    (@cboakes)


    Hi there,

    What is the best way to separate page headers with the ‘/’ symbol?
    Currently I am just using:
    wp_list_pages(‘title_li=0&sort_column=menu_order’);
    to display the page titles.

    Any help would be greatly appreciated,

    Thanks

    Chris

Viewing 5 replies - 1 through 5 (of 5 total)
  • You don’t have to separate the links with anything. They’re already in an unordered list. If you want to separate them, you could use CSS to add a graphical list bullet that would act as a separator or you could add a left or right border – again using CSS.

    Thread Starter cboakes

    (@cboakes)

    Thanks esmi,

    I managed to figure out by simply looking up the ‘wp_list_pages’ in the codex, there I was able to find that there is in fact a parameter that can be passed called ‘link_after’, which does what I want. So to display a / character after each link I would simply just pass the parameter like this:

    wp_list_pages(‘title_li=0&sort_column=menu_order&link_after= /’);

    Chris

    You’ll of course have a / after every link including the last.. if that works with what you have fine, else you’d just need to return the data and do a little PHP magic to not show the / when printing the last item.

    Thread Starter cboakes

    (@cboakes)

    I did notice that – it is an issue that I’m going to try and solve.

    What do you think would be the best way to approach it?

    Thanks

    After looking at this more in-depth i realise that using echo=0 with wp_list_pages is pretty useless..

    You don’t get an array of the results, you get one long string… which is pretty useless without some regex to move things around, but that’s a really horrible way to manage the results.

    Other functions give you the items as an array with the echo parameter set to 0 (off), but wp_list_pages seems to be an exception in this case..

    Such a shame… because the only solution i can see for dealing with this is to use various lines of regex, which would get very messy very quickly…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Separating wp_list_pages with a /’ is closed to new replies.