[resolved] Trim Category Name on the Category Archive Page (3 posts)

  1. azlobicki
    Posted 2 years ago #

    Hello! I am pretty new to WordPress and am currently developing a mobile version of a blog. I am trying to trim the category name that displays on the category archive page, since some of the categories are too long and do not fit nicely on small mobile devices. I tried using the PHP function substr(single_cat_title(), 0, 20); though it does not work. Help would be greatly appreciated. Thank you for reading. =]

  2. Michael
    Part-Time Forum Moderator
    Posted 2 years ago #


    to use the category title in a string manipulation, set the parameter $display to false so that the result is 'return'ed instead of 'echo'ed.

  3. azlobicki
    Posted 2 years ago #

    Thank you very much alchymyth, I really appreciate it! =] I feel a bit silly now that I know my answer was in the Codex. Sorry to clog the forums with this topic.

Topic Closed

This topic has been closed to new replies.

About this Topic