Support » Plugin: YARPP - Yet Another Related Posts Plugin » Better integration of YARPP and Polylang

  • Resolved Chouby


    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.

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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:

    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! 🙂

    Thread Starter Chouby


    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 🙂

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

    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!

    This is good news… You guys rock! 🙂
    Thanks a lot

    Thread Starter Chouby


    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!
    Polylang and YARPP

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Better integration of YARPP and Polylang’ is closed to new replies.