• Resolved PG

    (@parulgarg2)


    Hi

    I am using WPML on my website that has Global (English) set as default language. I had a post that was available in danish for many years. Today after I added it’s translation to Global, the count of the danish post is now starting from 1 again. After debugging I see you are showing post views from default language post instead. Can this not be current post id instead ? Let me know if there is any way out.

    Thanks
    Parul

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @parulgarg2,

    As you already realized, WordPress Popular Posts stores views count data using the ID of the default language version of your posts (in your case, the English one).

    To restore the views data from that particular post try looking for its ID on WPP’s database tables (_popularpostsdata and _popularpostssummary) and change it to the ID of the English version. Make a backup of your database first though in case you need to rollback changes for whatever reason.

    Thread Starter PG

    (@parulgarg2)

    I have more than 500 posts, so that’s not feasible.

    For both global and danish I am showing most popular posts of last 7 days
    [wpp range=’last7days’ limit=10 stats_views=1 order_by=’views’ post_type=’post’ cat=’218′ stats_taxonomy=1]

    here the cat id is danish. For global, I use global cat id.

    For global it works fine. Shows me correct numbers. but for Danish, why am I still getting old numbers (i.e. non-default language count) whereas if I open the danish post then I see default language count and it increases that number only.

    Plugin Author Hector Cabrera

    (@hcabrera)

    I have more than 500 posts, so that’s not feasible.

    Yes, editing a large number of items by hand is indeed a difficult task. However, you can batch update database items with a query like (untested, do not run this, it’s just an example):

    UPDATE tablename SET postid = X WHERE postid = Y;

    If you’re not familiarized with database queries in general I highly recommend reaching out to the people who maintain your website and ask them to assist you with this.

    About your other question, this was already explained above.

    • This reply was modified 1 year, 1 month ago by Hector Cabrera. Reason: Fixed typo
    Thread Starter PG

    (@parulgarg2)

    Hi

    Thanks for your reply. but my problem is still not solved. I have made peace with not having to update the old views to the translated posts. But all I want is, in danish version to show the views just like I have in Global.

    I don’t understand why there is a difference here. When I see individual post views, I see views from it’s default language. But when I want to see popular posts of category then it doesn’t show me views from default language..

    FYR, this is global page with popular articles https://www.uniconta.com/unipedia/ and this is danish with popular articles https://www.uniconta.com/da/unipedia/

    Please help me out.

    Thanks

    Plugin Author Hector Cabrera

    (@hcabrera)

    I don’t understand why there is a difference here.

    From what you’ve said so far it seems that your popular posts data may be a little messed up. This should fix it.

    Thread Starter PG

    (@parulgarg2)

    Hi Hector

    I tried doing it for 1 post to check if this works, but popular posts from danish is still empty. After the database update, it should show atleast 1 post there but unfortunately no.

    I strongly feel there is a code difference here. When fetching views inside the post, then default language views are getting showed whereas when I am using shortcode with cat id then it does not check for default language.

    Plugin Author Hector Cabrera

    (@hcabrera)

    If it’s the category ID that’s making the difference then my guess is that your Danish category isn’t a direct translation of the English one, that could explain it. Just as with posts, WPP expects taxonomies (categories, tags, etc) to be translated into every language too.

    Thread Starter PG

    (@parulgarg2)

    No, the categories are properly translated.

    Plugin Author Hector Cabrera

    (@hcabrera)

    I’m out of ideas then, sorry. I already suggested everything I could think of. If you ever figure out what the problem is please feel free to leave a comment here.

    Thread Starter PG

    (@parulgarg2)

    Ok. I am able to find a catch here. What’s working for me now is having to use the cat id of global unipedia in danish site shortcode. This way it is now showing the popular articles of last 7 days in danish translation.

    Thanks for all your help though.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Current language post id’ is closed to new replies.