Translate CPT selection in posts with Polylang

Support MB Custom Post Type Translate CPT selection in posts with PolylangResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #24458

    Hi there.
    I have a custom post type and added to posts a meta box where I can select the CPT. This is my code:

        // Selection for exhibitor on admin posts page
        $meta_boxes[] = [
          'title'      => esc_html__( 'Exhibitor', 'ex' ),
          'id'         => 'exhibitor',
          'post_types' => ['post'],
          'context'    => 'side',
          'priority'   => 'low',
          'autosave'   => true,
          'fields'     => [
            [
              'name'        => esc_html__( 'Assigned exhibitor', 'ex' ),
              'id'          => 'exhibitor',
              'type'        => 'post',
              'post_type'   => 'exhibitor',
              'field_type'  => 'select_advanced',
              'placeholder' => esc_html__( 'Select an exhibitor', 'ex' ),
              'query_args'  => array(
                'post_status'    => 'publish',
                'posts_per_page' => - 1,
              ),
              'ajax' => true
            ]
          ]
        ];

    I do also use Polylang to translate the content.
    I want to make sure the selected CPT (in my case the exhibitor) it is "translated". It is not working out of the box. I found this topic https://wordpress.org/support/topic/metabox-and-polyang/ which points me to https://wpml.org/documentation/support/language-configuration-files/.
    I created a wpml-config.xml file with this content:

    <wpml-config>
    
      <custom-fields>
        <custom-field action="translate">exhibitor</custom-field>
      </custom-fields>
    
    </wpml-config>

    But, I do not get the field translated.
    There are several questions:
    1.) Is the file correct?
    2.) Where Do I habe to store the file? In the plugin directory, which is setting up the meta box or, in the theme directory?
    Thank you for your reply!

    #24466
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please take a look at my screen record https://share.getcloudapp.com/eDu8jpyr.

    The custom field post is translated as well even I do not use the file wpml-config.xml. Can you please take a screen record if the field cannot be translated?

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.