Support » Fixing WordPress » add special character using link_before or link_after

  • Is there a way to use a special character in this:
    <?php wp_list_pages('title_li=&link_after=&rarr;'); ?>

    the goal is link name with an arrow as part of the link.

    I don’t know php, and have tried copying various things but nothing shows:
    <?php wp_list_pages('title_li=&link_after="&rarr;"'); ?>
    <?php wp_list_pages("title_li=&link_after='&rarr;'"); ?>
    <?php wp_list_pages('title_li=&link_after=' . __('&rarr;') . ' '); ?>

    Is there a way to escape or something so a special character using an ampersand will work in the php line?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Any ideas on this one? I’m running into this issue also.

    You need to pass your options as an array through a variable to the function:

    $arguments = array('title_li' => '&raquo; My Title', 'link_after' => '&rarr;');

    Hope that helps.


    Any idea how to get the same functionality out of wp_list_categories? for some reason, that doesn’t seem to have been brought in with 2.7.


    I too am trying to add something similar with category links.

    Any workaround?

    I have the same issue here. Is there any way to add special character as » as a prefix to the list of categories generated by wp_list_categories?

    I would really appreciate any guidance on how to achieve this!


    @vasilescu_anton the easiest way is probably through CSS. Just identify the container (probably something like ‘#sidebar ul li’ in your theme’s ‘style.css’) and change the li:before and put in the hex code for the character you want.

    Try adding

    #sidebar ul ul li:before {
    content: “0BB 020”;

    And I have another question…

    I am using link_after in wp_list_pages and trying to incorporate the meta data from each page. In this case it’s part of a url to an image in order to reconstruct an img tag.


    wp_list_pages('title_li=&child_of=3&link_after=<img src="' .
    bloginfo('siteurl') .
    get_post_custom_values('the_key', $id) . '.jpg'); ?>

    Obviously this is wrong, but how do I retrieve that data during the wp_list_pages function?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘add special character using link_before or link_after’ is closed to new replies.