WordPress.org

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] Limit characters in title of the post (10 posts)

  1. trivision
    Member
    Posted 1 year ago #

    Hi, I have Yarp plugin 4.0.6 and I'm trying to limit characters. Currently it shows only up to 2 lines when displayed as horizontal thumbs.

    I have tried adding: substr(get_the_title(), 0, 90) instead of: get_the_title(). I have added this in template-thumbnails.php on line #45. When I set up max 4 it will work but I need to show ENTIRE title and some of my titles are too long.

    I also tried playing with CSS, thiniking there is not enough space to display. I was able to have very long box for thumbnail but text still was limited to 2 line. I have changed font size but still nothing.

    I have moved template files OUT of the plugin folder directly to my theme and still nothing.

    Running out of option to try :(

    http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/

  2. trivision
    Member
    Posted 1 year ago #

    I solved it myself! :)

    I have used CSS to overwrite the space given to display title.
    I have added this so now my title is shown in all.
    a .yarpp-thumbnail-title {padding-bottom:30px;}

    I still recommend to use substr(get_the_title(), 0, 90) instead of: get_the_title() to control the length ;)

    Cheers!

  3. tnehub
    Member
    Posted 1 year ago #

    Hi trivision,

    I would like to increase the thumbnail title from 2 lines to 3 lines.

    How can I do this please?

    Thanks in advance.

    Donna

  4. trivision
    Member
    Posted 1 year ago #

    have you tried adding CSS?
    a .yarpp-thumbnail-title {padding-bottom:30px;}

  5. tnehub
    Member
    Posted 1 year ago #

    Hi,

    Which file do I add this to please?

  6. trivision
    Member
    Posted 1 year ago #

    you can add this to any css. You should have style.css inside your Theme folder.

  7. tnehub
    Member
    Posted 1 year ago #

    Hi,

    I tried it and no luck.

    I also made the changes to the template-thumbnails.php like you suggested above and still no luck.

  8. trivision
    Member
    Posted 1 year ago #

    where did you add the css code? were you able to locate your style.css file?

    when I work with css elements to assure that I'm applying properties to correct element I often add either background-color: red; or border: 1px red solid;

    If you add one of the above properties you should see this reflected on your page. If you don't see it it means you didn't apply the css correctly and you might add additional div or class before your

    a .yarpp-thumbnail-title {padding-bottom:30px;
    background-color: red;}

  9. tnehub
    Member
    Posted 1 year ago #

    Hi Trivision,

    Tried and it wasn't applying properly.

    But I found the answer myself.

    To increase the number of lines of the thumbnail title from 2 to 3

    1. Go to yet-another-related-posts-plugin/styles-thumbnails.php

    2. Each line has a height of 1.4em so go to line 45 and change max height to 4.8em to get 3 lines;

    max-height: 4.2em;

    Solved :)

  10. trivision
    Member
    Posted 1 year ago #

    glad you found it! I'm sure there are more ways to achieve this. So far we found 2! Good job and thanks for sharing ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yet Another Related Posts Plugin (YARPP)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic