New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WPP only in current language (with WPML) #102
Comments
Hey @anou, I've tested your code on a project I am currently working on and encountered a possible bug. While embedding the Popular Posts into a post results in the expected behaviour, embedding them into a static front page or a static posts page now only shows the original language posts. I am using Polylang 1.8.1 with Wordpress Popular Posts 3.3.3 on Wordpress 4.4.2. |
Is this feature still actively being looked into? |
Hey @PatrickD1985, I'm not actively working on this at the moment. Right now my focus is on ironing out a few minor bugs that popped out with the release of the 4.0.x series and will move on to adding new features / changes (4.1.x most likely) once I'm done with that. No ETA, of course. |
Ah a shame. But I get it. |
I just came to a conclusion; The views currently are shared! Which makes sense because the item is actually the same entity but just in different languages. Views should account to both (jn my belief anyway) So to summarize an English post increases the amount for the original Dutch item. And vice versa. Well I played around a bit. And have it working!! I will make a writeup for the WPP part (I suck at Github actually otherwise I would have done it that way) but it is pretty feasible to do this without too much hassle. And get back on this. |
That's correct. That was actually the initial thought I had when I first implemented multilingual support. And I still believe it's a valid point of view, as you said yourself it's the same entity. On the other hand, for a few years now some people out there are (mis)using multilingual plugins to be able to have two "separate" sites without having to set up a multisite network or a separate single WordPress setup for each language. In this scenario it makes sense to also want to have WPP track views separatedly as well.
Looking forward to it :) All suggestions are welcome, and I'm sure others will appreciate your input as well. |
For in the functions.php (yes keeping it there was easiest for now as I dislike doing direct edits in plugin files etc.
Look for the Lines with WPML in the above Now as for the most important thing, how to get Ajax to play along nicely. As noted due to some system setups of mine I had to use a different approach but the implementation should be fairly the same; My original AJAX localize was;
I changed that to this;
Now the actual handling need to be dealth with. Intially my function was;
Which I altered to
And that is all there is to it. Hope it helps anyone that is truly the reason I looked into it ... beside me wanting to be able to do it of course. Edit ok the top part comes out a bit garbled with either code or quote blocks, So I have attached the function just in case. |
Hi, |
Hi well I am using a different AJAX approach opposed to the normal AJAX action by WPP. If you could provide an example of what is happening that might help solve it, |
Hi there! |
Hello,
The way WPML is supported, means that if a post doesn't have a translation, the original post is displayed...
If you want to display only post in the current language, I've made this little modification in wordpress-popular-posts.php, line 1857
private function __render_popular_post($p, $instance)
:Replace code from
if ( defined('ICL_LANGUAGE_CODE')
... to closing bracket line 1878, just before$title = $this->_get_title($p, $instance);
with
and put the closing bracket just before the `return' statement :
This way only posts in the current language will be displayed.
I have a patch if needed.
And thanks for your work.
The text was updated successfully, but these errors were encountered: