2

I have custom post type named soto_property in which I have added three wp_editor as post meta, using this code -

 wp_editor( htmlspecialchars_decode($valueeee1),
               'propertyEditor1',
               $settings = array('textarea_name'=>'detail',
                                 'editor_class'=>'propertyEditor')
              );

    wp_editor( htmlspecialchars_decode($valueeee2),
               'propertyEditor2',
               $settings = array('textarea_name'=>'features',
                                 'editor_class'=>'propertyEditor')
              );

    wp_editor( htmlspecialchars_decode($valueeee3),
               'propertyEditor3',
               $settings = array('textarea_name'=>'text_to_pdf',
                                 'editor_class'=>'propertyEditor')
              );

Now I have installed qtranslate plugin to make my site Multilingual. This plugin automaticaly add Language tab in its default content editor. I want to add these languages tabs in my custom editor also, so it can save content in defined languages.

How can I do this.? Please help me.

3

it looks as already answered here on stackexchange (really detailed way), as first you can try:

add_filter('soto_property','qtrans_convertURL');

Anyway, have a look here on qtranslate slug plugin, usually it save tons of troubles. And small note - if I were you, I would better use mqTranslate (which is based on qTranslate, but it's compatible with last version of WP)

  • Hey.thank for reply. I have added add_filter('soto_property','qtrans_convertURL'); in qtranslate_hook.php but nothing happened. and the URL which you suggested me that didn't make enough sense to me. I couldn't found out that what I have to do after reading that. Could you please explain me little more about the answer mentioned at that URL.? – shashank Feb 23 '15 at 15:26
1

I have done custom post type with multiple content editors ready to translate, I have used This Metabox Plugin to add the meta boxes, this plugin allows you to create multiple meta boxes according to the theme requirements, to achieve your requirements, 1st install this plugin Here is the link Then add code as follows in your functions.php or separate file then include to functions.php

global $meta_boxes;
$meta_boxes   = array();

$meta_boxes[] = array(

    'id' => 'standard',
    'title' => __( 'Simple Editors', 'your-languge-key' ),
    'pages' => array( 'your-post-type' ),
    'context' => 'normal',
    'priority' => 'high',
    'autosave' => true,
    'fields' => array(
        array(
                'name' => __( 'Simple Editor', 'your-languge-key' ),
                'id'   => "{$prefix}home-bottom-content",
                'type' => 'wysiwyg',
                // Set the 'raw' parameter to TRUE to prevent data being passed through wpautop() on save
                'raw'  => true,
                'std'  => __( 'WYSIWYG default value', 'your-languge-key' ),

                // Editor settings, see wp_editor() function: look4wp.com/wp_editor
                'options' => array(
                    'textarea_rows' => 4, 
                    'teeny'         => true,
                    'media_buttons' => false, // mediabuttons to editor
                ),
            ),
    ),

);
/**
 * Register meta boxes
 *
 * @return void
 */
function rw_register_meta_boxes()
{
    global $meta_boxes;

    // Make sure there's no errors when the plugin is deactivated or during upgrade
    if ( class_exists( 'RW_Meta_Box' ) ) {
        foreach ( $meta_boxes as $meta_box ) {
            if ( isset( $meta_box['only_on'] ) && ! rw_maybe_include( $meta_box['only_on'] ) ) {
                continue;
            }

            new RW_Meta_Box( $meta_box );
        }
    }
}

add_action( 'admin_init', 'rw_register_meta_boxes' );

/**
 * Check if meta boxes is included
 *
 * @return bool
 */
function rw_maybe_include( $conditions ) {
    // Include in back-end only
    if ( ! defined( 'WP_ADMIN' ) || ! WP_ADMIN ) {
        return false;
    }

    // Always include for ajax
    if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
        return true;
    }

    if ( isset( $_GET['post'] ) ) {
        $post_id = intval( $_GET['post'] );
    }
    elseif ( isset( $_POST['post_ID'] ) ) {
        $post_id = intval( $_POST['post_ID'] );
    }
    else {
        $post_id = false;
    }

    $post_id = (int) $post_id;
    $post    = get_post( $post_id );

    foreach ( $conditions as $cond => $v ) {
        // Catch non-arrays too
        if ( ! is_array( $v ) ) {
            $v = array( $v );
        }

        switch ( $cond ) {
            case 'id':
                if ( in_array( $post_id, $v ) ) {
                    return true;
                }
            break;
            case 'parent':
                $post_parent = $post->post_parent;
                if ( in_array( $post_parent, $v ) ) {
                    return true;
                }
            break;
            case 'slug':
                $post_slug = $post->post_name;
                if ( in_array( $post_slug, $v ) ) {
                    return true;
                }
            break;
            case 'category': //post must be saved or published first
                $categories = get_the_category( $post->ID );
                $catslugs = array();
                foreach ( $categories as $category )
                {
                    array_push( $catslugs, $category->slug );
                }
                if ( array_intersect( $catslugs, $v ) )
                {
                    return true;
                }
            break;
            case 'template':
                $template = get_post_meta( $post_id, '_wp_page_template', true );
                if ( in_array( $template, $v ) )
                {
                    return true;
                }
            break;
        }
    }

    // If no condition matched
    return false;
}

Here I have added only one editor, you can add number of editors by reusing editor filed. Hope this is solve your issue. good luck !

0

Solved!

I have used qranslate-x plugin which makes my custom wp_editor translatable on my custom post type page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.