Hi. Im building a website with a danish admin. Everything seems to work fine in danish, except the post_type name in the Relationship UI. I have looked into the code in the plugins relationship.php. And its obvious that they use the get_post_type() to echo out the right aligned title.
I could hack this, by changing line 294:
$title .= get_post_type();
To:
$post_type_object = get_post_type_object( get_post_type( $post ) );
$title .= $post_type_object->labels->singular_name;
But this means “Hacking the plugin” – which i dont prefer doing.
Is there another way for me to achieve this same result? its seems obvious to me that this would be a better way of insuring translated admins?
Hi @[email protected]
Thanks for the issue. I’ll look into this and push a fix to the github repo soon.
Thanks
E
Hi @[email protected]
Thanks again for your issue and your fix.
I have pushed this fix to the core!
Thanks
E
Hi elliot – thank you so much! Amazing support here!
Note: these changes should also be made to the right side of the UI on line 495, although a little different:
changing:
$title .= $p->post_type;
To:
$post_type_object = get_post_type_object( get_post_type( $p ) );
$title .= $post_type_object->labels->singular_name;
And also in the “select”, where you can select a posttype. Current code looks like this around line 451:
foreach( $field['post_type'] as $post_type )
{
$choices[ $post_type ] = $post_type;
}
Im not completely sure what the best way would be here, as i don’t quite understand the acf filters.
But that should then fix it for this field, i think. Im impressed with the quick response!
Hi @[email protected]
Thanks for the follow up. I’ll look into this soon.
Cheers
E
Hi @[email protected]
Thanks again for your work on this.
I’ll leave the post_type
name in the settings as is, but I have added the translate code to the ‘right column’ on the relationship field.
Thanks
E