WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a question about code on wordpress: I am trying to use code wp_list_bookmarks to list my featured communities that I have setup in "links categories." I want to be able to separate each link like the following:

San Diego | La Jolla | Rancho Santa Fe | Del Mar

I am currently using: <?php wp_list_bookmarks('title_li=&category_before=&category_after=&category=21'); ?>

It does work, but displays like this:

  • San Diego
  • La Jolla
  • Rancho Santa Fe
  • Del Mar

Again, I want this:

San Diego | La Jolla | Rancho Santa Fe | Del Mar

Any code recommendations?

share|improve this question

Not extremely elegant, but should work...

$sep = " | ";
$args = array(
    'echo'=>0     //return the string, don't echo
$str = wp_list_bookmarks($args);
//chop off the last separator...
$str = substr($str, 0, strlen($str) - strlen($sep));
echo $str;

EDIT -- I added before and after to the $args array -- these are actually what _walk_bookmarks() uses before and after each link.

share|improve this answer
woops. I screwed up. Editing... – Chris Carson Aug 6 '11 at 17:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.