• DCuserName

    (@dcusername)


    Hello,

    New to the plugin, I haven’t found a solution to this in the documentation so far but appologies if it’s something obvious that I’m missing.

    I have a lot of instances of generating content via get_posts() for custom post types, then looping through to generate content on page templates etc. It looks like PolyLang only retrieves posts that have been translated already within the current language. I’m wondering if there is any way to retrieve all posts in the default language instead, unless there is a translation? It would be nice to not leave holes in the content while a client finishes translating, or if they only intend to translate some pieces.

    Or as an alternative, has anyone come up with a “copy all” kind of add-on for PolyLang, basically to click a button in the admin and loop through ALL pages, posts, custom posts, etc. and add exact copies to a new language? Then content could be hand translated later without worrying about missing pieces.

    Thanks!
    David

    https://ww.wp.xz.cn/plugins/polylang/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Chouby

    (@chouby)

    Hi!

    Queries with get_posts() are explained here: https://polylang.pro/doc/developpers-how-to/

    Thread Starter DCuserName

    (@dcusername)

    Ah! Thanks so much, sorry I missed that. So maybe what I need to do then is write a function that abstracts that a bit, either retrieving posts from the default language first, and splicing in any translations in the current language. That could have a high overhead for performance I guess, but useful in some situations.

    I’d still love to hear if anyone has implemented a kind of “clone all to new language” system, copying all content, custom fields, attachments, etc., from the primary language to another. I suppose ideally things should just be carefully translated a piece at a time, and permalink slugs would be better kept in the new language than copied from the old.

    Thanks again for a great plugin by the way, so much more stable and usable than others I’ve tried!
    David

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

The topic ‘PolyLang and get_posts()’ is closed to new replies.