WEB How do I add a seperator to this v. wordpress list pages

Discussion in 'OT Technology' started by Browning, Jan 29, 2010.

  1. Browning

    Browning Active Member

    Joined:
    Feb 14, 2005
    Messages:
    89,465
    Likes Received:
    10
    How do I add a separator to this v. wordpress list pages

    would like to make my page menu so it has a separator like so

    home | page | page | page

    Code:
    <ul>
       <li<?php if ( is_front_page() ) echo ' class="current_page_item"'; ?>><a href="<?php echo get_option('home'); ?>/"><span>Home</span></a></li>
    <?php $pages = wp_list_pages('sort_column=menu_order&title_li=&echo=0');
    $pages = preg_replace('%<a ([^>]+)>%U','<a $1><span>', $pages);
    $pages = str_replace('</a>','</span></a>', $pages);
    echo $pages; ?>
      </ul>
    help? :o
     
    Last edited: Jan 29, 2010
  2. Browning

    Browning Active Member

    Joined:
    Feb 14, 2005
    Messages:
    89,465
    Likes Received:
    10
    got this to work but not sure if it's the correct way of doing it

    Code:
    <ul>
       <li<?php if ( is_front_page() ) echo ' class="current_page_item"'; ?>><a href="<?php echo get_option('home'); ?>/"><span>Home</span></a></li>  |  
    <?php $pages = wp_list_pages('sort_column=menu_order&title_li=&echo=0');
    $pages = preg_replace('%<a ([^>]+)>%U','<a $1><span>', $pages);
    $pages = str_replace('</a>','  |  </span></a>', $pages);
    echo $pages; ?>
      </ul>
    edit-this seems to work better

    Code:
    <ul>
       <li<?php if ( is_front_page() ) echo ' class="current_page_item"'; ?>><a href="<?php echo get_option('home'); ?>/"><span>Home</span></a></li>&nbsp;&nbsp;|&nbsp;&nbsp;
    <?php $pages = wp_list_pages('sort_column=menu_order&title_li=&echo=0');
    $pages = preg_replace('%<a ([^>]+)>%U','<a $1><span>', $pages);
    $pages = str_replace('</a>','</span></a>&nbsp;&nbsp;|&nbsp;&nbsp;', $pages);
    echo $pages; ?>
      </ul>
     
    Last edited: Jan 29, 2010
  3. Browning

    Browning Active Member

    Joined:
    Feb 14, 2005
    Messages:
    89,465
    Likes Received:
    10
    actually this seems to work better since it doesn't add an extra | after the last listed page

    Code:
    <ul>
       <li<?php if ( is_front_page() ) echo ' class="current_page_item"'; ?>><a href="<?php echo get_option('home'); ?>/"><span>Home</span></a></li>
    <?php $pages = wp_list_pages('sort_column=menu_order&title_li=&echo=0');
    $pages = preg_replace('%<a ([^>]+)>%U','&nbsp;&nbsp;|&nbsp;&nbsp;<a $1><span>', $pages);
    $pages = str_replace('</a>','</span></a>', $pages);
    echo $pages; ?>
      </ul>
    hell yeah motherfuckers
     

Share This Page