WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. azlobicki
    Member
    Posted 1 year 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. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    http://codex.wordpress.org/Function_Reference/single_cat_title

    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
    Member
    Posted 1 year 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

Tags