Forums

Limit at recent comments: title and author char (2 posts)

  1. N33D
    Member
    Posted 3 years ago #

    i have recent comments and recents posts on a sidebar. And because of my design i want to limit the chars of the
    - title on recent comments
    - author on recent comments
    - title on recents posts

    Q: I looked into widget.php and can find the Recent comments function, but can't find the recent posts function?

    Q: How can i limit the char on these title and author?

    I did it on my title on the homepage, but that title is different.

    The way how i did it on my homepage:

    Functions.php:

    // Limit the title char on the homepage
    function short_title($before = '', $after = '', $echo = true, $length = false) {
    $title = get_the_title();
    if ( $length && is_numeric($length) ) {
    $title = substr( $title, 0, $length );
    }
    if ( strlen($title)> 0 ) {
    $title = apply_filters('short_title', $before . $title . $after, $before, $after);
    if ( $echo )
    echo $title;
    else
    return $title;
    }
    }
    ?>

    On my index.php:
    <?php short_title('', '', true, '40'); ?>

    But they seems to be different at the recent comments..

  2. denzel2364
    Member
    Posted 2 years ago #

    also looking for this

Topic Closed

This topic has been closed to new replies.

About this Topic