WordPress.org

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] Better integration of YARPP and Polylang (7 posts)

  1. Chouby
    Member
    Posted 2 years ago #

    Hi Mitcho!

    Since this topic, I decided that Polylang should support YARPP, so the language taxonomy is now registered with the YARPP option and I hope everything works well.

    Now I got the logical request to translate the user strings (stored in YARPP options) such as "Related posts", "No related posts", etc... It's quite easy to do and I proposed a first way to translate some of them.

    But I would like to go on my integration work and propose an out of the box solution. So I can collect all the relevant options and use the way proposed in the link above...

    However, you are likely to add new strings in the future and it won't be easy for me to follow the development of YARPP. Could it be possible for you to group your strings so that for example when I do a get_option('yarpp');, it returns something like:

    'threshold' => 4
    'limit' => 4
    'strings' => array(
    	'before_related' => '<h3>'.__('Related posts:','yarpp').'</h3><ol>',
    	'no_results' => '<p>'.__('No related posts.','yarpp').'</p>'
    ...

    Thus I will know that I will have to translate all what is in the 'strings' array and the integration of both plugins won't be broken if you change or add a new string.

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

  2. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    I don't think this is the best way to accomplish what you want to do.

    I think a better idea is to ship a "custom YARPP template" which includes code for these language-specific strings:

    http://mitcho.com/blog/projects/yarpp-3-templates/

    Users would then be instructed to copy this file into their theme, and select this custom template in YARPP settings. Then the output will no longer be dependent on these strings in YARPP settings at all.

    I hope that helps. Let me know if you have any other questions. I'd love to see more plugins have better YARPP support built in! :)

  3. Chouby
    Member
    Posted 2 years ago #

    Thank you for your answer. Clearly my suggestion was the result of a lack of knowledge of YARPP. I looked at the templates supplied with YARPP and found one 'yarpp-template-wpml.php'. I just made a test and as I expected it works out of the box (I just needed to load the template one time on frontend to get the strings registered, but I guess it is the same with WPML).

    So maybe, you should just modify the description of your template to:
    An example template for use with the WPML and Polylang plugins :)

  4. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Great! I renamed the template to be multilingual instead of WPML. This will ship in the next version of YARPP. Here's a preview:

    http://downloads.wordpress.org/plugin/yet-another-related-posts-plugin.zip

    I'd appreciate it if you could test it. If there's any other information on using YARPP with Polylang, if you write up some documentation or something, I'd love to link to it in the readme. :) Thanks!

  5. lucabarbetti
    Member
    Posted 2 years ago #

    This is good news... You guys rock! :)
    Thanks a lot

  6. Chouby
    Member
    Posted 2 years ago #

    I finally found the time to write step by step instructions to setup YARPP and Polylang to make them work together. Hope it will help!
    http://polylang.wordpress.com/2013/05/03/polylang-and-yarpp/

  7. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 2 years ago #

    Fantastic! I'll add it to the YARPP readme.

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