About this plugin
CMB2-qTranslate is WordPress plugin for CMB2 and qTranslate X integration. Adds language switch buttons above selected CMB2 fields to make content translatable.
com/jmarceli/integration-cmb2-qtranslate.
Supported CMB2 field types:
- input
- textarea
- wysiwyg
- repeatable field groups
cmb2-qtranslate class to it. 3 version).
Usage example
WYSIWYG field:
$field1 = $cmb_demo2->add_field( array( 'name' => __( 'SECOND Text', $this->plugin_slug ), 'desc' => __( 'field description (optional)', $this->plugin_slug ), 'id' => $prefix. $this->plugin_slug. '_second_text', 'class' => 'cmb2', 'type' => 'wysiwyg', 'options' => array( 'editor_class' => 'cmb2-qtranslate' ) ) );
Other fields:
$field2 = $cmb_demo->add_field( array( 'name' => __( 'Text Small', $this->plugin_slug ), 'desc' => __( 'field description (optional)', $this->plugin_slug ), 'id' => $prefix. $this->plugin_slug. '_textsmall', 'class' => 'cmb2', 'type' => 'text', 'attributes' => array( 'class' => 'cmb2-qtranslate' ) ) );
// You may also use data-attributes instead of class to trigger qTranslate for the field // however it is not supported by WYSIWYG field (WordPress limitation)
$field2 = $cmb_demo->add_field( array( 'name' => __( 'Text Small', $this->plugin_slug ), 'desc' => __( 'field description (optional)', $this->plugin_slug ), 'id' => $prefix. $this->plugin_slug. '_textsmall', 'class' => 'cmb2', 'type' => 'text', 'attributes' => array( 'data-cmb2-qtranslate' => true ) ) );
com/WebDevStudios/CMB2/wiki).
Usage on custom Theme Options Page:
com/qTranslate-Team/qtranslate-x/wiki/Custom-page-(plugin)-integration
You should define at least one form field in $admin-config array to trigger qTranslate LSB on your custom Theme Options Page. In other case you will end up with not working LSB. It happens because by default qTranslate is available only on specific pages: content pages, general options and maybe some others, but not your custom page (if you will create one).
Requirements/Dependencies
- CMB2 (https://pl.wordpress.org/plugins/cmb2/)
- qTranslateX (https://pl.wordpress.org/plugins/qtranslate-x/)
Links
- Github project page