Closed anou closed 5 years ago
Screenshot for illustration :
Hi, can you please paste your config here?
/**
* Exopite Simple Options Framework
*
* @link https://github.com/JoeSz/Exopite-Simple-Options-Framework
* @author Joe Szalai
*/
global $post;
$config_metabox = array(
// METABOX
'type' => 'metabox', // Required, menu or metabox
'id' => 'ava-meta', // Required, meta box id, unique, for saving meta: id[field-id]
'post_types' => array( 'post' ), // Post types to display meta box
'context' => 'advanced',
'priority' => 'default',
'title' => __('Posts options', 'mh'), // The name of this page
'capability' => 'edit_posts', // The capability needed to view the page
'tabbed' => true,
'multilang' => true,
);
$fields[] = array(
'name' => 'all_posts',
'title' => __('All posts', 'mh'),
'icon' => 'dashicons-sticky',
'fields' => array(
array(
'id' => 'mh-ontitle',
'type' => 'text',
'title' => __('Post On-title', 'mh'),
'default' => esc_attr(get_post_meta($post->ID, 'mh-ontitle', true)),
'attributes' => array(
'placeholder' => __('Enter on-title','mh'),
),
'help' => __('It will be displayed before post title','mh'),
),
array(
'id' => 'mh-subheading',
'type' => 'text',
'title' => __('Post Subheading', 'mh'),
'default' => esc_attr(get_post_meta($post->ID, 'mh-subheading', true)),
'attributes' => array(
'placeholder' => __('Enter subheading', 'mh'),
),
'help' => __('It will be displayed below post title', 'mh'),
),
),
);
/**
* Second Tab
*/
$fields[] = array(
'name' => 'interviews',
'title' => __('Interviews', 'mh'),
'icon' => 'dashicons-microphone',
'fields' => array(
array(
'id' => 'mh-interview-state',
'type' => 'checkbox',
'title' => __("Interview's state", 'mh'),
'label' => __('On going', 'mh'),
'after' => '<i>' . __('Check this box if this post is an on going interview', 'mh') . '</i>',
'wrap_class' => 'no-border-bottom'
),
array(
'type' => 'fieldset',
'id' => 'fieldset_interviewee',
'title' => esc_html__( 'Interviewee Informations', 'mh' ),
'description' => esc_html__( 'Informations are used in the Interview widget', 'mh' ),
'options' => array(
'cols' => 2,
),
'dependency' => array( 'mh-interview-state', '==', 'true' ),
'fields' => array(
array(
'id' => 'interviewee_img',
'type' => 'image',
'title' => __('Interviewee Visual', 'mh'),
),
array(
'id' => 'interviewee_name',
'type' => 'text',
'title' => __('Interviewee Name', 'mh'),
),
array(
'id' => 'interviewee_corp',
'type' => 'text',
'title' => __('Interviewee Corporation', 'mh'),
),
array(
'id' => 'interviewee_function',
'type' => 'text',
'title' => __('Interviewee Function', 'mh'),
),
),
),
)
);
$metabox_panel = new Exopite_Simple_Options_Framework( $config_metabox, $fields );
I tried with multilang => true
and without (it is false
by default) with no success
Hi,
I will take a closer look in the weekend.
multilang => true
has no affect in metabox, this is for options.
multilang => true
is to translate values.
Use this option if you want a different text in textarea, input, etc... for different languages.
In page/post/other cpt, WPML and other does this automatically.
Ok. I forgot to load the textdomain. I updated. Can you try again?
What you did is to load_textdomain()
for the translation of your framework? I'll be happy to do it for you 😃
But my problem is to translate my custom configuration in my theme. So maybe it is not related with your framework but with the way code is loaded in wordpres?
It is like my custom config does not know the website is in french...
Found it! 😄
I was require_once
outside of add_action('after_setup_theme', 'my_theme_setup');
so the config did know about the textdomain I imagine.
Once I included the required files inside the theme set-up every thing got translated.
So this issue is solved :) Thank you for the info. I also plan to use the framework in my next theme. (I didnt use it or try it with a theme before)
Hello, I'm using your framework in a theme but I can not get my string to get translated. I include my metaboxes file after theme_setup() but without any luck on getting my strings translated.
If I use default metaboxes action
add_action('add_meta_boxes',...
everything gets translated.Any idea on what I'm missing will be much appreciated ;-) Thx