WordPress.org

Support

Support » How-To and Troubleshooting » Adding text before each cat, in category list

Adding text before each cat, in category list

  • I need a little assistance as I cannot find a solution to my problem.

    All i want to do is add:

    <span class=\”green\”>»</span>

    before the output of list_cats, to give a >> bullet.

    I dont want to use css as I dont intend to have the categories as an unordered list.

    Any solutions?

    I think it may have something to do with filtering but i cannot make it function.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Maybe you can use “recurse” as an option for that and do with with a little php.

    http://codex.wordpress.org/Template_Tags/list_cats

    great idea 😀

    This worked:
    $cats = list_cats(true, ‘View all’, ‘name’,’asc’, ”, true, false, true, true, false, false,”, ‘0’, true, ”, ”, ‘1,2,3’, false);
    $cat = explode(”,$cats);

    foreach ($cat as $value){
    $value = str_replace(”

  • “, “<span class=\”green\”>»</span> “, “$value”);
    $value = str_replace(” “, “”, “$value”);
  • $value .=”;
    echo $value;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding text before each cat, in category list’ is closed to new replies.
Skip to toolbar