How to exclude certain custom post types from translation?

Having Problems? Need Help? Post here!

How to exclude certain custom post types from translation?

Postby saifis » Tue May 31, 2011 11:47 am

Hi, sorry if this is a noob question.

I have custom post types in my wordpress, and some do not require translation, is it possible to disable the translation boxes that appear in them?

Thanks in advance.
saifis
 
Posts: 1
Joined: Tue May 31, 2011 11:42 am

Re: How to exclude certain custom post types from translation?

Postby sariha » Mon Jun 06, 2011 2:45 pm

Hello,
I just find a solution : I edited the file qtranslate_wphacks.php (in the plugin dir)
The idea is to specify witch post_type you don't want the title to be translated.

around the line 110, you have a little loop :
Code: Select all
foreach($el as $language) {
         $content .= qtrans_insertTitleInput($language);
      }

I changed that by :
Code: Select all
$post_type = get_post_type();
   if($post_type != "pages_album" && $post_type != "pages_artist"){
      foreach($el as $language) {
         $content .= qtrans_insertTitleInput($language);
      }
   }


Where "pages_album" & "pages_artist" are the post type I don't want to translate the title.

next step, around the line 120 you have this :
Code: Select all
   // hide old title bar
   $content .= "document.getElementById('titlediv').style.display='none';\n";

I made the same change :
Code: Select all
   // hide old title bar
   if($post_type != "pages_album" && $post_type != "pages_artist"){
      $content .= "document.getElementById('titlediv').style.display='none';\n";
   }


I hop the change are clear, and I'm sorry for my approximate english, witch is not my native language ^^
sariha
 
Posts: 1
Joined: Mon Jun 06, 2011 2:33 pm


Return to qTranslate Support Forum

Who is online

Users browsing this forum: Google [Bot] and 5 guests

cron