Support » Fixing WordPress » Can anyone translate this code?

  • I’ve inherited a site from someone else and am trying to figure out why the navbar is not linking anywhere. There’s this code in the template:

    <?php echo preg_replace('@\<li([^>]*)>\<a([^>]*)>(.*?)\<\/a>@i', '<li$1><a$2><span>$3</span></a>', wp_list_pages('echo=0&orderby=name&exlude=181&title_li=&depth=1?')); ?>

    If you look at the page source for this page:

    The links are there, but they’re dead on the site.

    Weird. Anybody have any idea what’s going on?

Viewing 1 replies (of 1 total)
  • It looks like it is taking a string like:
    <li part1><a href="part2">part3</a>
    and changing it to:
    <li part1><a href="part2"><span>part3</span></a>
    I don’t see what purpose the span tags serve.

    You might try taking out the preg_replace to see what you get without it. Compare that to the results with it and you may get a better idea of what is going on.

    <?php echo wp_list_pages('echo=0&orderby=name&exlude=181&title_li=&depth=1?'); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Can anyone translate this code?’ is closed to new replies.