Snippets

Language Dependent Float

When you need to build a theme that support in LTR but also in RTL you need small functions that makes life easier! This couple of function saved my a lot of time and weight on un-needed css code! Use it wisely yound jedi

function fright() {
    if(is_rtl()) {echo 'fright';} else {echo 'fleft';}
}

function fleft() {
    if(is_rtl()) {echo 'fleft';} else {echo 'fleft';}
}

Source: http://www.sagive.co.il/wordpress-snippets/...

Share this snippet

 
  • http://blog.piotrnalepa.pl sunpietro

    I think there’s a mistake in the second function. It always return left. BTW. pretty useless in serious development.

  • http://www.sagive.co.il Sagive SEO

    Right you are… the css is also missing here (i did submit it :( ) i hope the code would display here.

    function fright() {
    if(is_rtl()) {echo ‘fright’;} else {echo ‘fleft’;}
    }

    function fleft() {
    if(is_rtl()) {echo ‘fleft’;} else {echo ‘fright’;}
    }

    // CSS:
    .fright {float: right !important;}
    .fleft {float: left !important;}