WordPress.org

Ready to get started?Download WordPress

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] YARPP not using the square thumbnails (17 posts)

  1. Mr Eddy
    Member
    Posted 1 year ago #

    Hi,

    I am testing the plugin and unfortunately, when I set it to use the "thumbnails" template provided, the plugin is retrieving the full size feature image instead of their square thumbnail.
    But I realised the PHP Custom thumbnail template is using those square thumbnails. Unfortunately, it's design isn't as good as your template.

    I had a look at your code and couldn't find out why it's retrieving the full size image and then resizing it to 120*120 instead of using the square 150*150 thumbnail and then resize it to 120*120.

    Any idea ?

    Regards,

    Eddy

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

  2. Mr Eddy
    Member
    Posted 1 year ago #

    Okay I finally found a way, on line 40 in template_thumbnails.php and changed this :

    $post_thumbnail_html = get_the_post_thumbnail( null, $dimensions['size'] );

    to

    $post_thumbnail_html = get_the_post_thumbnail();

    Of course the problem is that if I update the plugin, I'll lose it.
    So I'm still looking for a reason why it wasn't using the square thumbnail. If you can help me :)

  3. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 1 year ago #

    What you'll want to do is follow the instructions in the readme on setting a different size... in your case, to 150x150. Check out the first two items in the FAQ section of the readme.

  4. Mr Eddy
    Member
    Posted 1 year ago #

    Sorry, but I tried this, and it didn't help at all since the problem is the way YARPP is working by default in my theme.
    As I said earlier, YARPP is picking the original size of my image instead of the suare thumbnail that is generated by default by WordPress.

  5. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 1 year ago #

    Which part of the FAQ instructions did you try?

  6. Mr Eddy
    Member
    Posted 1 year ago #

    This one :
    The thumbnail size can be specified programmatically by adding add_image_size( 'yarpp-thumbnail', $width, $height, true ); to your theme's functions.php file with appropriate width and height variables. In the future I may add some UI to the settings to also set this... feedback is requested on whether this is a good idea.

    The part about creating thumbnail didn't apply to my situation, since those thumbnails were already created.

    That's why I tweaked your template as written above :)

  7. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 1 year ago #

    You should check out the other part of the FAQ, which recommends the "Regenerate Thumbnails" plugin and also tells you how to make YARPP automatically generate the appropriate thumbnails.

  8. Mr Eddy
    Member
    Posted 1 year ago #

    I've seen this part but don't understand why I should regenerate thumbnails, since they exist. Or did I misunderstood the goal of regenerating thumbnails ?

  9. masspamak
    Member
    Posted 1 year ago #

    You could use this in you main style.css file, you may have any squared image resized proportionally to the desired size. I use it this way and it works fine, my original tumbnails are 160x160, then I needed to have them smaller in my footer where I show related post, this css style did the trick. Hope it help.

    .relatedthumbs img {
    height: 120px;
    width: 120px;
    }

  10. Mr Eddy
    Member
    Posted 1 year ago #

    I don't get any class named relatedthumbs. Did you add it ?

    Anyway, I updated the plugin, and no luck. It's still using the wrong files. If I understand it correctly, YARPP find 150 x 150 px thumbnails too much different from the appropriate size it needs (120 x 120px) ?

    In the meantime, the only solution I find is tweaking template-thumbnails.php by removing the null, $dimensions['size']

    I can't take the risk to mess up with all my thumbnails, since they're used for my theme and as featured images.

  11. masspamak
    Member
    Posted 1 year ago #

    I use featured image too, based on 160x160, I use nextgen gallery, and everything, it is a bit tricky to get all of this working fine, but with css you can resolve a lot of rendering matters, I guess the default css class for the yarpp-template-thumbnail.php (hope you will use this one, this seems the best way to customize your YARPP on any page using your post thumbnails) is (.relatedthumbs img) and with that added on my style.css (from my template directory) it works fine, YARPP did modify nothing with my other settings, did no touch any of my images or thumbnails, I'm afraid that it can depends on configuration or plugins conflict, but as I've said, nextgen, yarpp, regenerate thumbnails and auto post thumbnails plugins installed and running I do not have any matters with YARPP using this css code. If you have a page I could have a look to it and may help better. No prob.

  12. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 1 year ago #

    @Mr Eddy Maybe I'm misunderstanding what you're trying to do. If you already have 150x150 thumbnails, and want YARPP to use 120x120 thumbs, unfortunately, as you noticed, WordPress doesn't just serve the 150x150 it seems, so it'll scale down the larger one. In that case, you want to regenerate thumbnails so nice 150x150 ones are created.

    If you want to use the 150x150, you should use the add_image_size to specify that yarpp-thumbnail size is 150x150. You could then use css, as @masspamak suggested, to resize this to whatever size you actually want. Hope that helps.

  13. Mr Eddy
    Member
    Posted 1 year ago #

    Thanks for your help. I understand !

    But how is it that my tweak above made it possible for the plugin to pick the 150x150 post thumbnails ? Why didn't you choose this "code" in fact ? Seems to be "easier" to work with ?

    If I followed correctly your post above, the add_image_size would use the largest image and then resize it to 150*150 ?

  14. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 1 year ago #

    @Mr Eddy If you used add_image_size, it should be using 150x150 images, if available. Like I said, if they're not, you should run the "Regenerate Thumbnails" plugin afterwards.

  15. Mr Eddy
    Member
    Posted 1 year ago #

    It's working properly know on a test website. We'll come back to say if it finally goes okay on the real one when the update will be done :)

    Thanks !

  16. RicoG
    Member
    Posted 11 months ago #

    Yes! It works. Thank you!.

  17. jeffparker
    Member
    Plugin Author

    Posted 11 months ago #

    Great! Glad to hear.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.