add special character using link_before or link_after (8 posts)

  1. csleh
    Posted 7 years ago #

    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?

  2. Casey Picker
    Posted 7 years ago #

    Any ideas on this one? I'm running into this issue also.

  3. ThemeBlender
    Posted 7 years ago #

    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.


  4. greggo
    Posted 7 years ago #

    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.


  5. leewilson78
    Posted 7 years ago #

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

    Any workaround?

  6. vasilescu_anton
    Posted 6 years ago #

    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!


  7. JoshKay
    Posted 6 years ago #

    @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";

  8. JoshKay
    Posted 6 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic