Meta Box and Polylang Pro Issue

Support General Meta Box and Polylang Pro Issue

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #48448
    Graham StanburyGraham Stanbury
    Participant

    Hello

    This issue follows on from the previous issue with displaying admin images, which was resolved in the following thread, plus email communications with Peter and Bao -> https://support.metabox.io/topic/conflict-with-polylang-pro-v3-7/

    The issue is that when creating a new translated language in Polylang Pro (using Metabox AIO v2.2.2), the metabox fields are not automatically carried across to the new language.

    Here are some screenshots showing this. Firstly, the original language:
    https://pasteboard.co/jL9rA1CesCk4.png

    Then the translated language. You can see that the some of the fields are presets and the rest are blank, e.g. the “Featured Vacancy” field, the “Vacancy Expiry Date" and the “Listing Image":
    https://pasteboard.co/st2NIGdyecrd.png

    This was working in Metabox AIO v.2.1.1, which I have tried again. The problem with not being able to edit images (as per the first paragraph) reappears of course.

    Can you help me please? We need the information to be transferred between language translations.

    #48466
    PeterPeter
    Moderator

    Hello Graham,

    I'm not able to reproduce the issue on my demo site. The field values are copied to the translation post. However, I think that it is not necessary because you also need to add the translation value to all fields on the translation post.

    If the image field is not working on your site, can you please export the field group to a JSON file and share it here? I will import the field group to my site and check the issue.
    Following the documentation https://docs.metabox.io/extensions/meta-box-builder/#export--import

    #48468
    Graham StanburyGraham Stanbury
    Participant

    Hi Peter

    This is Mike, Graham's WP developer. Many thanks for your reply.

    I can't export the field group unfortunately as the fields were created as part of a functionality plugin.
    However, I can give you the code from the plugin:

    1. the specific method which is called in that plugin, and which contains the fields from the screenshots, is in this pastebin -> https://pastebin.com/UGJQErsZ
    2. the method is called using add_filter( 'rwmb_meta_boxes', array( $this, 'obr_register_meta_boxes' ) ); in the __construct()

    We have the translation domain "awaw" on some of the field definitions but not all of them. This was all working on Meta Box AIO v2.1.1 but if I need to update it for newer versions, do please let me know.

    Many thanks for your assistance
    Mike

    #48469
    PeterPeter
    Moderator

    Hello,

    I got the issue. Please add the setting translation to the meta box settings to translate the field or copy the value to the translation post when duplicating the post. For example:

    $meta_boxes[] = [
        'title'   => __( 'Job Specific Information', 'awaw' ),
        'id'      => 'obr_special_info',
        'post_types' =>  'book',
        'context' => 'normal',
        'translation' => 'translate', // here
        'fields'  => [
    ...
        ]
    

    Please follow the documentation https://docs.metabox.io/integrations/polylang/#custom-fields

    #48472
    Graham StanburyGraham Stanbury
    Participant

    Thank you Peter

    That's great for the specific fields.

    Do I need to do something similar for the title, description, excerpt, etc, please? I can't see that in the documentation unfortunately.

    Many thanks
    Mike

    #48473
    Graham StanburyGraham Stanbury
    Participant

    Apologies, I should have added the code...

    		function obr_custom_post_type_job() {
    			$labels = array(
    				'name'                => _x( 'Jobs', 'Post Type General Name', 'awaw' ),
    				'singular_name'       => _x( 'Job', 'Post Type Singular Name', 'awaw' ),
    				'menu_name'           => __( 'Jobs', 'awaw' ),
    				'name_admin_bar'      => __( 'Job', 'awaw' ),
    				'parent_item_colon'   => __( 'Parent Job:', 'awaw' ),
    				'all_items'           => __( 'All Jobs', 'awaw' ),
    				'add_new_item'        => __( 'Add New Job', 'awaw' ),
    				'add_new'             => __( 'Add New', 'awaw' ),
    				'new_item'            => __( 'New Job', 'awaw' ),
    				'edit_item'           => __( 'Edit Job', 'awaw' ),
    				'update_item'         => __( 'Update Job', 'awaw' ),
    				'view_item'           => __( 'View Jobs', 'awaw' ),
    				'search_items'        => __( 'Search Jobs', 'awaw' ),
    				'not_found'           => __( 'Not found', 'awaw' ),
    				'not_found_in_trash'  => __( 'Not found in Trash', 'awaw' ),
    			);
    			$args = array(
    				'label'               => __( 'Job', 'awaw' ),
    				'description'         => __( 'Post Type Description', 'awaw' ),
    				'labels'              => $labels,
    				'supports'            => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt' ),
    				'hierarchical'        => false,
    				'public'              => true,
    				'show_ui'             => true,
    				'show_in_menu'        => true,
    				'menu_position'       => 5,
    				'show_in_admin_bar'   => true,
    				'menu_icon'           => 'dashicons-list-view',
    				'show_in_nav_menus'   => true,
    				'can_export'          => true,
    				'has_archive'         => 'jobs', //was true
    				//'has_archive'         => true,
    				'exclude_from_search' => false,
    				'publicly_queryable'  => true,
    				'capability_type'     => 'page',
    				'rewrite'			  => array(
    												'slug' => 'job',
    											),
    			);
    			register_post_type( 'job', $args );
    			flush_rewrite_rules();
    		}
    
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.