我用WordPress制作了一个2种语言的网站,我需要说:
如果html方向是RTL,使用一些代码,否则使用另一个代码..。
我试过用我在Joomla用的传统方法
<?php if( $this->direction=="rtl"){ ?> /images/slider/01.jpg" alt="Slider 01" title="#htmlcaption" /> /images/slider/02.jpg" alt="Slider 02" title="#htmlcaption" /> /images/slider/03.jpg" alt="Slider 03" title="#htmlcaption" /> /images/slider/04.jpg" alt="Slider 04" title="#htmlcaption" /> **هذا** مثال لما يمكن ان يكتب هنا. /images/slider/01.jpg" alt="Slider 01" title="#htmlcaption" /> /images/slider/02.jpg" alt="Slider 02" title="#htmlcaption" /> /images/slider/03.jpg" alt="Slider 03" title="#htmlcaption" /> /images/slider/04.jpg" alt="Slider 04" title="#htmlcaption" /> PROVIDING COST-EFFECTIVE AND RELIABLE MARINE TRANSPORTATIONS **This** is an example of a HTML caption with a link. **This** is an example of a HTML caption with a link. **This** is an example of a HTML caption with a link. 但它总是说有致命的错误..。我想我需要将$this定义为html页面,但是如何在PHP中这样说呢?
在第7行的C:\AppServ\www\wordpress\wp-content\themes\wp\index.php中未在对象上下文中使用$this
发布于 2012-11-15 15:53:27
似乎它内置了另一个名为"language_attributes()“的函数。试试这个:
// if ( function_exists( 'is_rtl' ) ) # You may need to utilize this if is_rtl() is not defined
if( is_rtl() == 'rtl' ){
// DO RTL code
}else{
// DO LTR code
}根据下列资料:
http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/general-template.php#L0
http://wpml.org/2011/06/creating-right-to-left-rtl-wordpress-sites/
Support
发布于 2012-11-15 15:39:20
试试这个:
$script_name=$_SERVER['SCRIPT_NAME'];https://stackoverflow.com/questions/13400850
复制相似问题