Want to Reduce Character Limit of Post Title in Archive Page

Support Forums for LiveMesh Themes & Plugins Forums Enigmatic Theme Support Want to Reduce Character Limit of Post Title in Archive Page

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6223
    Kovairkovair
    Member

    Hi,

    Could you please help me get rid of displaying long post titles in the archive page as shown here http://dev.kovair.com/category/white-papers/.

    I understand that the post title on Archive page is being fetched from the individual post. So, is there a way I can set a character limit for the post titles on Archive page?

    Please help me with the solutions.

    Thanks
    Sanat

    #6270
    RaghavendraRaghavendra
    Moderator

    Sanat,

    You will need to modify the file framework/functions/post-functions.php at line number 19 to insert this elseif condition –

        elseif (is_archive())
            $title = '

    '. mo_truncate_string(get_the_title(), 20) . '

    ';

    and you method mo_get_entry_title() should finally look like –

    function mo_get_entry_title() {
        global $post;
    
        if (is_front_page() && !is_home())
            $title = the_title('

    ', '

    ', false); elseif (is_singular()) $title = the_title('

    ', '

    ', false); elseif (is_archive()) $title = '

    '. mo_truncate_string(get_the_title(), 20) . '

    '; else $title = the_title('

    ', '

    ', false); /* If there's no post title, return a default title */ if (empty($title)) { if (!is_singular()) { $title = '

    ' . __('(Untitled)', 'mo_theme') . '

    '; } else { $title = '

    ' . __('(Untitled)', 'mo_theme') . '

    '; } } return $title; }

    Hope this helps.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Enigmatic Theme Support’ is closed to new topics and replies.