• Resolved wpwebhr

    (@wpwebhr)


    Hello,

    I’m working on a real estate site. I need to export a custom post type as a custom XML feed. Is it possible to pull all the data from english version and only titles and descriptions in another two languages?
    This is what I need:

    <property>
    <property-id>ID<property-id>
    <property-title>TITLE</property-title>
    <property-desc>DESCRIPTION</property-desc>
    <property-size>SIZE</property-size>
    . . . (all the other data)
    <property-title-DE>TITLE DE</property-title-DE>
    <property-title-IT>TITLE IT</property-title-IT>
    </property>

    There is a WPML language selector which allows you to choose one language or all of them, but that doesn’t solve my problem. Would it be doable with WP_Query?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @wpwebhr,

    Is it possible to pull all the data from english version and only titles and descriptions in another two languages?

    Yes, but you’d have to write a custom PHP function to get the data from the other languages: https://www.wpallimport.com/documentation/export/pass-data-through-php-functions/.

    Here’s a basic example function that you can modify as needed:

    function my_get_description( $language, $idpost ) {
        $postid = apply_filters( 'wpml_object_id', $idpost, 'post', FALSE, $language );
        $post = get_post( $postid );
        if ( !empty( $post ) ) {
            return $post->post_content;
        }
    }

    Example usage:

    <spanishdescrip>[my_get_description("es",{ID})]</spanishdescrip>

    Plugin Author WP All Import

    (@wpallimport)

    Hi @wpwebhr,

    I’m marking this as resolved since it’s been inactive for a while. Please open a new topic if you still have questions.

    • This reply was modified 5 years, 2 months ago by WP All Import.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WPML export’ is closed to new replies.