• jr-suraj

    (@jr-suraj)


    I’m using polylang for translating pages. But I don’t wanna translate posts. Posts will be single language. It doesn’t show when I publish posts without translating. How can I? Please !!

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • anonymized-13603639

    (@anonymized-13603639)

    You still need a post in each language. In your case the solution can be to copy the post 1:1 to all languages, so in fact Polylang gets the post (with different ID) in the requested language but with the same content.

    • This reply was modified 7 years ago by anonymized-13603639.
    Thread Starter jr-suraj

    (@jr-suraj)

    Thanks #lachender_engel for the advice. So no way to ignore translating posts. anyway, thank you so much.

    anonymized-13603639

    (@anonymized-13603639)

    @jr-suraj Not sure what you mean with “ignore translating posts”?
    How do you expect Polylang should ignore posts?

    This is my use case as well:

    * A site in Spanish, Catalan and English.
    * Offering to visitors the interface in different languages through automatic browser detection and language switcher is important.
    * Pages describe the project and it is good to have all of them translated.

    Until here Polylang works perfectly well. But then…

    * Posts can be in any of these languages, but we don’t want the separation by languages. We don’t have the capacity to translate everything. Most readers will understand these languages at some degree anyway. We want them to find all the posts regardless of their preferred language.
    * Duplication of pages with the same content is problematic. We want all users (search bots etc) to hit one page instead of many with the same content. Also, each post generates a Discourse forum automatically, and we don’t want separate forum threads created for essentially the same post.

    For these reasons, Polylang for pages but not for posts would be a better scenario. Polylang solves well the case of different user groups or communities speaking different languages and not having much interaction between them. However, humans also group in truly multilingual communities where different languages can be read and spoken by the same people.

    You can turn off translations for posts with a hook:

    function turn_blogposts_translation_off( $post_types, $is_settings ) {
      unset( $post_types['post'] );
      
      return $post_types;
    }
    
    add_filter( 'pll_get_post_types', 'turn_blogposts_translation_off', 10, 2 );
    • This reply was modified 6 years, 10 months ago by certainlyakey.

    Hi @certainlyakey

    Your code works perfectly for me, I would like to ask you if you know how to deactivate also Polylang for the Categories and Tags of Post.

    Thank you!

    You can turn off translations for category and tags of post by following this code:

    Turn Off Translations for Category

    function turn_categoryblog_translation_off( $taxonomies, $is_settings ) {
        unset( $taxonomies['category'] );
        return $taxonomies;
    }
    add_filter( 'pll_get_taxonomies', 'turn_categoryblog_translation_off', 10, 2 );

    Turn Off translations for tag

    function turn_tagblog_translation_off( $taxonomies, $is_settings ) {
        unset( $taxonomies['post_tag'] );
        return $taxonomies;
    }
    add_filter( 'pll_get_taxonomies', 'turn_tagblog_translation_off', 10, 2 );

    Is this code still right? I’m including in the bottom of functions.php. It hides the option of translating posts in the back-end, but my page still shows only translated content. Moreover, if I’m using one language, then I read a post/page in another, it changes the menus and widgets to the language of that content and, if then I come back to the index page, It keeps using that language instead of the one I was using at the beginning.

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Translating just for pages, not for posts with Polylang’ is closed to new replies.