WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
[resolved] Pagelines Framework Anything Boxes plugin and Polylang (14 posts)

  1. janpeeters
    Member
    Posted 1 year ago #

    Hi Chouby,

    you have been working on providing me with full translation of the Pagelines Framework. The question at post:
    http://wordpress.org/support/topic/plugin-polylang-site-title-and-tagline-are-not-changing/page/2?replies=46 is still open but there is also another problem.

    One of the Pagelines Devs has developed a Anything Boxes plugin. This provides me with the nice latest posts boxes on the frontpage of:
    http://www.janpeeters.nl. At the moments things are allright. But with a recent update the plugin started showing all posts of both languages on the same frontpage. So I had to revert to an older version.

    Adam Munns the developer of this plugin would love to get in touch to ask you how your plugin works precisely so that he could tackle the problem. He asks "Do you know what the polylang requirements are from a template point of view. I just don't see the relationship, but if I could learn something about PolyLang that would be great help." Maybe he also knows how Pagelines Framework communicates with WPML.

    Hopefully you can be so kind as to contact him via the plugin website (I can't post his email adres here and I don't have yours):
    http://www.pagelines.com/store/sections/anything-boxes/?product_ref=true
    So that there is a direct line between the two of you.

    Thanks in advance,

    Jan

    http://wordpress.org/extend/plugins/polylang/

  2. janpeeters
    Member
    Posted 1 year ago #

    Hi Chouby,

    I was wondering if you have read the above post and had time to look into it. Would love to solve this. If you need more info let me know.

    Thanks, Jan

  3. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Here is my philosophy and my priorities:

    The plugin must work "perfectly" with the WordPress core and default themes.

    If any developer requests help to make its plugin or theme (Premium or free) compatible with Polylang, then he/she is most welcome in this forum and I will give all the help I can. There are already some plugins which have been adapted :)

    I try to help users installing Polylang and solve conflicts as much as I can. I usually can find a solution when I can do the tests myself on my test site. It's really very difficult to help with Premium themes and plugins which I cannot freely download.

    I plan in the future (after v1 will be released) to test Polylang with most top rated plugins and themes to ensure the compatibility when possible.

    So I am sorry to say that I won't contact your plugin author. Just because, as you see, I have plenty of other things to do before.

  4. janpeeters
    Member
    Posted 1 year ago #

    That's a clear answer thanks. I'll report back to the dev.

  5. janpeeters
    Member
    Posted 1 year ago #

    Hi Chouby,

    I've reported back and I got the following question from Adam. I'll function as an intermediate for now.

    Can you ask the polylang people why this wouldn't work with their plugin:

    echo apply_filters('the_content', $ab->post_content);

  6. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    I see no reason why this would not work. Polylang does not play with the filter 'the_content'. And of course there is no conflict with the WordPress core when applying the same filter. I would expect that the conflict is elsewhere.

    But with a recent update the plugin started showing all posts of both languages on the same frontpage

    Probably we should start from this statement. Was this an update of Polylang or an update of Anything boxes which created the problem?

  7. janpeeters
    Member
    Posted 1 year ago #

    Hi, thanks again for getting back.

    It was after a update to the Anything Boxes plugin. When it went from 1.0.1 to 1.2 things got wonky. I'd expect that the dev of Anything Boxes would know. But it's probably a tricky one.
    If I can get you a copy of the plugin would you be willing to install it and have a quick look?

    Jan

  8. janpeeters
    Member
    Posted 1 year ago #

    Hi,

    Adam writes back that he sent incomplete code...

    Hey Jan,

    Question…the code I sent was incomplete and I'm wondering if polylang uses short codes to create content.

    ab_trim_excerpt(apply_filters('the_content', $ab->post_content), $ab_excerpt_len );
    
    the function above is defined below
    
    function ab_trim_excerpt($text, $length) {
    
    	$text = strip_shortcodes( $text ); // optional
    	$text = strip_tags($text);
    
    	$words = explode(' ', $text, $length + 1);
    	if ( count($words) > $length) {
    		array_pop($words);
    		$text = implode(' ', $words);
    	}
    	return $text.'&nbsp;<span class="hellip">&hellip;</span>';
    }

    Does this code and the question Adam asks give new insight?

    Thanks, Jan

  9. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Not at all. Polylang does not use shortcodes and never modifies a post content. Among multilingual plugins, Polylang is in the category "one post per language" just as WPML.

    Basically, Polylang "just" filters the queries to get the result in the requested language.

    But with a recent update the plugin started showing all posts of both languages on the same frontpage

    I re-read the first post. It could be a problem of timing. I don't know (or remember) the Polylang settings you are using.

    if you add the language code to all urls, then Polylang language sets the language very soon in a 'setup_theme' action. On the other hand, if you set the language from content, Polylang needs to know about it before it can sets the language. It is done in a 'wp' action.

    If the query done by Anything boxes is done before the language is set, then it should get all languages. So if Anything boxes as moved its query earlier in the process, this could explain the difference in results that you obtain.

  10. janpeeters
    Member
    Posted 1 year ago #

    Hi, thanks again.

    I have tested again.
    In my current setup things are like this:

    O When the front page is visited, set the language according to the browser preference

    X The language is set from content. Posts, pages, categories and tags urls are not modified.
    O The language code, for example /en/, is added to all urls when using pretty permalinks.

    X Remove /language/ in pretty permalinks. Example: http://www.janpeeters.nl/en/
    O Keep /language/ in pretty permalinks. Example: http://www.janpeeters.nl/language/en/
    O Hide URL language information for default language

    O When using static front page, redirect the language page (example: http://www.janpeeters.nl/en/) to the front page in the right language

    X Allow to synchronize categories, tags, featured image and other metas between translations of a post or page

    I've switched to 'add language code to all URLs' and I've tested with 'When using static front page…' activated. Together and separately and that didn't give any different results. SO I'll report back this also back to AnyBox dev.

    If you have any other idea after reviewing my current settings your most welcomce.

    Best, Jan

  11. janpeeters
    Member
    Posted 1 year ago #

    Hi Chouby (I've not yet figured out the F of your real name that I saw in the wp plugin list ;-) François?)

    Adam has finally solved it and if you hear what was the problem you will probably think 'what a waste of my time'. Sorry for that, but shame aside I thought I report back it might help others in the future.

    Pagelines Framework has a separate settings area in the edit page window to be able to do customizations also on a page-by-page basis. This area has a 'save settings' button apart from the Publish button in the WP page edit view.

    I started a translated page with the Polylang widget in the edit sidebar and everything looked just fine. Settings were filled in and looked allright. The silly thing was that I had to re-save the Anything Boxes settings on the new page. This was unexpected.

    After doing that Polylang can normally differentiate between Dutch and English posts.

    So thank you for all your help and thinking with me. It brought it to a solution.

    Jan

  12. Chouby
    Member
    Plugin Author

    Posted 1 year ago #

    Hello Jan,

    I am very happy that you finally found the solution. And no that was not a waste of time. I am sure that your bad experience will profit to many Pagelines + Polylang users!

    Thanks to you, I learned the Pagelines dev team is workin on Polylang support. So maybe they will be able to improve this...

    Polylang has a nice feature to copy or synchronize metas between translations. It natively works with featured image and page template.

    It does not work out of the box with metas created by plugins and themes but it is rather easy to add them in the list using the filter 'pll_copy_post_metas'.

    I am not sure that these 'PageLines Meta Settings' are stored in post meta but that would make sense. Maybe the Pagelines dev team will be interested to support this feature.

    Frédéric

  13. janpeeters
    Member
    Posted 1 year ago #

    Thanks for the positive response Frédéric. And thanks again!

  14. janpeeters
    Member
    Posted 1 year ago #

    By the way, I'll contact the Pagelines devs to see if this can be implemented.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic