我正在使用wordpress作爲CMS創建多語種網站。文本格式不能與qTranslate插件配合使用
我使用qTranslate插件進行多語言支持。只要我啓用插件,所有格式的文本都會丟失。即編輯器中的所有段落都合併成一個段落。
我已經在設置中啓用了這個選項:「WordPress應該自動糾正無效嵌套的XHTML」,但沒有改變。
有什麼建議嗎?
我正在使用wordpress作爲CMS創建多語種網站。文本格式不能與qTranslate插件配合使用
我使用qTranslate插件進行多語言支持。只要我啓用插件,所有格式的文本都會丟失。即編輯器中的所有段落都合併成一個段落。
我已經在設置中啓用了這個選項:「WordPress應該自動糾正無效嵌套的XHTML」,但沒有改變。
有什麼建議嗎?
我發現這裏的解決方案: http://www.teslina.com/en/748/wordpress/qtranslate-code-syntax-bugfix/
但是我懷疑,當它更新插件添加的代碼將被刪除。
寫簡單的職位,以html模式來測試像這樣:
<p>lorem</p>
<p>ipsum</p>
有過濾器WordPress的格式化文本(插件,或者functions.php中)試圖找到他們,否則嘗試另一個插件像Polylang。
在的wp-content \主題末尾添加該代碼\您的主題名稱\的functions.php:
//************************** PATCH START *****************************
// Fix for qTranslate plugin (that does not retain formatting in pages)
if('html' != wp_default_editor()) {
remove_filter('the_editor_content', 'wp_richedit_pre');
add_filter('the_editor_content', 'wp_htmledit_pre');
}
remove_filter('the_content', 'wpautop');
if (! function_exists('tmce_replace')) {
function tmce_replace() {
$tadv_options = get_option('tadv_options', array());
$tadv_plugins = get_option('tadv_plugins', array());
?>
<script type="text/javascript">
if (typeof(jQuery) != 'undefined') {
jQuery('body').bind('afterPreWpautop', function(e, o){
o.data = o.unfiltered
.replace(/caption\]\ +?<\/object>/g, function(a) {
return a.replace(/[\r\n]+/g, ' ');
});
}).bind('afterWpautop', function(e, o){
o.data = o.unfiltered;
});
}
</script>
<?php
}
add_action('after_wp_tiny_mce', 'tmce_replace');
}
function teslina_tinymce_config($init) {
$init['remove_linebreaks'] = false;
$init['apply_source_formatting'] = true;
$init['preformatted'] = true;
$init['remove_redundant_brs'] = false;
return $init;
}
add_filter('tiny_mce_before_init', 'teslina_tinymce_config');
//************************** PATCH END *******************************