WordPress.org

Support

Support » How-To and Troubleshooting » Plus sign in wp_list_pages

Plus sign in wp_list_pages

  • Hi all,

    Using the code below, I’m trying to add a css-styled “+” in front of my menu items:

    <?php wp_list_pages('title_li=&child_of=989&link_before=<span class="sideplus">+</span>'); ?>

    On my page, the plus won’t show up. It is visible however in a regular “ul” without the use of the template tag.

    Is there a way (other than using a “\” or the ascii-version, which don’t work) to show this +? Other characters like a minus or a letter show up just fine.

    Thanks,
    Stef

Viewing 2 replies - 1 through 2 (of 2 total)
  • esmi

    @esmi

    Forum Moderator

    It would be far better if you used CSS for this. Perhaps using the pseudo :before selector on the li. Or simply as a list background image.

    Fixed it after all.

    The trick is in replacing the + with it’s PHP equivalent “%2B” as such:

    <?php wp_list_pages('title_li=&child_of=987&link_before=<span class="sideplus">%2B</span>'); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plus sign in wp_list_pages’ is closed to new replies.
Skip to toolbar