WP: If Statement

I made a 2 language site in WordPress and I need to say that:

if html direction is RTL use some code else use another code…

Read More

I’ve tried this with the traditional way that I use in 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.

But it always says there a fatal error.. I think I need to define $this as html page
but how to say that in PHP?

: Using $this when not in object context in C:AppServwwwwordpresswp-contentthemeswpindex.php on line 7

Related posts

Leave a Reply

2 comments

  1. It appears that it us built into another function called “language_attributes()”. Try this:

    // 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    
    }
    

    Based on the following information:

    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/

    http://codex.wordpress.org/Right-to-Left_Language_Support