WordPress.org

Ready to get started?Download WordPress

Forums

Truncating topic title in sidebar only (2 posts)

  1. jamble
    Member
    Posted 5 years ago #

    Hi,

    I'm trying to create a theme that requires my sidebar widget for recent posts to be a certain width but obviously I'd like it to be able to account for posts with a longer title.

    What I'm trying to do is truncate the links shown in the sidebar widget to say 35 characters but not truncate the title itself on the post page which is what the truncate title plugin does.

    I just want to make the title link short in the sidebar widget.

    Anyone have any thoughts on how I can do this?

    Many thanks.

  2. green2go
    Member
    Posted 5 years ago #

    Hi,

    Don't know whether your going to find this useful now (March 09) but this maybe helpful for others.

    The only way I found to get round it is to 'Hack' the internal WordPress functions (not supported by WordPress since v1.5).

    You can achieve this by using PHPs substr function.

    I modified the functions adjacent_post_link & next_post_link to accept additional optional parameters to implement a truncate switch.

    It's going to make it a pain to upgrade but oh well . . .

    Oliver

Topic Closed

This topic has been closed to new replies.

About this Topic