Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to add custom meta in qTranslate with Wordpress

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 335
    Comment on it

    Hello Friends,

    If you are working in a multilingual project and using qTranslate plugin for language translation in wordpress. You can see custom meta fail to save multi languages in the database. Please follow the below step to get solution of this problem. 

    Step 1 : Open your function.php and define the id  of your custom post meta. In the below example I have added three fields in district, location, latitude and longitude. Please follow the below example:

    //Add custom tender meta boxes
    function caption_review_meta_box_airstrip($post) {    
        $district = esc_html(get_post_meta( $post->ID, 'district', true));
        $location = esc_html(get_post_meta( $post->ID, 'location', true));
        $latitude = esc_html(get_post_meta( $post->ID, 'latitude', true));
        $longitude = esc_html(get_post_meta( $post->ID, 'longitude', true));
        ?>
    
    <!--Please define the ID custom meta-->
    
        <table style="width:100%;">
    		<!----Here we have defined District -->
                    <tr>
    		    <td style="width: 20%">District</td>
    		    <td style="width: 40%">
    		    	<input type="text" name="district" id = "district" value="<?php echo $district; ?>" />
    		    </td>
    		</tr>
                    <!----Here we have defined Location -->
    		<tr>
    		    <td style="width: 20%">Location</td>
    		    <td style="width: 40%">
    		    	<input type="text" name="location" id="location" value="<?php echo $location; ?>" />
    		    </td>
    		</tr>
                    <!----Here we have defined Latitude -->
    		<tr>
    		    <td style="width: 20%">Latitude</td>
    		    <td style="width: 40%">
    		    	<input type="text" name="latitude" id="latitude" value="<?php echo $latitude; ?>" />
    		    </td>
    		</tr>
                   <!----Here we have defined Longitude -->
    		<tr>
    		    <td style="width: 20%">Longitude</td>
    		    <td style="width: 40%">
    		    	<input type="text" name="longitude" id = "longitude" value="<?php echo $longitude; ?>" />
    		    </td>
    		</tr>
        </table>
    
    <?php
    }

    Step 2 : Open your admin panel and click at Settings from left panel ---> Language -->Integration. Here you can see as I have attached screen shot, we have set my custom meta id like district, location, latitude and longitude under ID text box.

    Now you can see mulitlanguage translator start working on these custom meta as well.

    Thank you

     

    How to add custom meta in qTranslate with Wordpress

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: