Forums

[resolved] title_li and ampersand (6 posts)

  1. tiresias53
    Member
    Posted 3 years ago #

    Does anyone know how I can get the title_li argument in wp_list_pages to return an ampersand?

    wp_list_pages ('title_li=<h3>'._('prices and places').'</h3>&child_of='.$post->ID);

    works but

    wp_list_pages ('title_li=<h3>'._('prices & places').'</h3>&child_of='.$post->ID);

    breaks. I've tried replacing the '&' with '&amp:' and '&amp;' but no joy.

    Does anyone know what I'm doing wrong?

  2. Nosferke
    Member
    Posted 3 years ago #

    You already tried & #38; ?

  3. tiresias53
    Member
    Posted 3 years ago #

    Thanks for the suggestion. I've tried that and still no joy.

    I've also tried surrounding '&' and '&amp;' and '&' in single and double quotes but nothing seems to work.

  4. tiresias53
    Member
    Posted 3 years ago #

    Oops! Forgot to use the code button. That should be: I've also tried surrounding
    &amp;amp; and & in single and double quotes but nothing seems to work

  5. Technokinetics
    Member
    Posted 3 years ago #

    As a workaround, how about:

    <h3>Prices &amp; Places</h3>
    <ul><?php wp_list_pages('title_li='); ?></ul>

    - Tim

  6. tiresias53
    Member
    Posted 3 years ago #

    Hmmm. I was working on the same sort of workaround but found it stripped out the "pagenav" li class.

    So I ended up with

    ?><li class="pagenav"><h3>Prices & Places</h3><ul><?php
    wp_list_pages ('title_li=&child_of='.$post->ID);
    ?></ul></li><?php

    which works but is inelegant, to say the least. I should have thought there was a cleaner way to do it.

    Anyway, thanks for the ideas.

Topic Closed

This topic has been closed to new replies.

About this Topic