Support » Plugin: WordPress Popular Posts » WPML and API REST questions

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Héctor Cabrera

    (@hcabrera)

    Hi @itartech,

    1. I need to obtain the popular posts for each language using the WPP REST API, but I just can get the main language popular posts.
    How can I build the API URL to get popular posts for the secondary languages?

    http://thenbp-app.itartech.com/wp-json/wordpress-popular-posts/v1/popular-posts/

    2. And related to this, how can I see the popular pots for the secondary languages in the WordPress Admin Panel?
    In “Options > WordPress Popular Posts > Stats” I only see the main language popular posts.

    To clarify: WordPress Popular Posts (just WPP from now on) unifies the views data of translations with their original posts as it considers translations to be a part of the same entity (the original post.) For that reason it’s no possible to list popular posts “per language.” It’ll be the same list of posts, only that WPP will display them in a different language if a translation is available for every post listed.

    Now to answer your question, currently the /wp-json/wordpress-popular-posts/v1/popular-posts/ endpoint only returns the original posts (Spanish posts in your case), not the translated ones. This is an oversight on my part as this endpoint should behave as the widget one and return posts in the currently active language. I never noticed it as I personally don’t use it and no one else ever reported this. That is until now 😛 Will look into it as soon as possible.

    Thread Starter itartech

    (@itartech)

    Hi @hcabrera ,

    Thank you very much for your response.

    We are currently working on a project where we need to get the popupar posts for each specific language. Sorry for being the first one to report this 😉

    If you find a solution to achieve that will help me a lot. Just to plan my own work, when do you approximately estimate to have a solution for the issue?

    Again, thank you very much!

    Plugin Author Héctor Cabrera

    (@hcabrera)

    No ETA for an official release as there are still some things that I need to review first to make sure everything’s in order.

    I created a new issue on Github to keep track of things: /wp-json/wordpress-popular-posts/v1/popular-posts/ endpoint doesn’t translate posts. You can follow the progress there (and even use the Github version of the plugin if you’re on a tight dealine until version 5.3 gets officially released to the public.)

    Thread Starter itartech

    (@itartech)

    Hi @hcabrera ,

    I’ll follow the Github issue.

    Thank you for your great work.

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Hey there!

    So just pushed some changes to the Github repo that allow the /popular-posts/ endpoint to switch languages if the lang parameter is present (assuming there are translations available of course.) Please give it a try and report back.

    Thread Starter itartech

    (@itartech)

    Hi!

    I’ve tested it and it seems to work great.

    Thank you very much!

    Plugin Author Héctor Cabrera

    (@hcabrera)

    Awesome! I’m marking this topic as resolved then since this code update will be included with the next version of the plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.