Polylang stops p2 (5 posts)

  1. Kangarooo
    Posted 3 years ago #

    I put p2
    Post: Can
    Post posted: yes
    On refresh: I see it

    I put polylang and put 3 languages so for each language there would be different language.
    Post: Can
    Post posted: yes
    On refresh: I dont see it

    It turns out that it doesnt auto gets language so its published without language and when they are without language they are not seenable on blog.
    What to do?


  2. Kangarooo
    Posted 3 years ago #

    1. Post name http://tls.lv/sample-post/
    2. Didnt changed Default home page- showing posts on each language
    3. 3 languages, Menus without lang, Dont check user browser lang, Default lang set, The lang is set from content, dont show /language/ in PP, Allow to sync cats tags.

    U can check my page and post i put there so that everyone can post without reg. http://tls.lv/

  3. Kangarooo
    Posted 3 years ago #

    I tried http://p2reloaded.com/ and that works a bit with polylang. It posts to default lang so if i change it post goes to that lang. So how to make it work allways can maybe found in that code? Heres my example page with that plugin working. http://talantufabrika.lv/
    If im in different lang then default i post and it pops up in place i am but on reloud its not there anymore but in default lang i can see it.

  4. Chouby
    Plugin Author

    Posted 3 years ago #

    For now Polylang can set the language of a post only from backend. So it means that P2 needs some adaptations. You can include this in a custom plugin:

    add_action('save_post', 'pll_p2_save_post', 5);
    add_action('create_term', 'pll_p2_save_term', 5);
    add_action('edit_term', 'pll_p2_save_term', 5);
    function pll_p2_save_post($post_id) {
    	global $polylang;
    	if (isset($polylang) && !$polylang->get_post_language($post_id) && isset($_COOKIE['wordpress_polylang']))
    		$polylang->set_post_language($post_id, $_COOKIE['wordpress_polylang']);
    function pll_p2_save_term($term_id) {
    	global $polylang;
    	if (isset($polylang) && !$polylang->get_term_language($term_id) && isset($_COOKIE['wordpress_polylang']))
    		$polylang->set_term_language($term_id, $_COOKIE['wordpress_polylang']);

    This should be a good starting point to make P2 multilingual. However, it won't solve all the issues. At least, the autocomplete tags form will display tags in all languages.

  5. Kangarooo
    Posted 2 years ago #

    Where do i put that? Im searching for string 'save_post' and only found it in themes\p2\js\p2.js but still there dont know where to change what.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Polylang
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic