Skip to content

Instantly share code, notes, and snippets.

@abouolia
Last active July 9, 2018 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save abouolia/27d103c5c33ca860f353d12c8252f607 to your computer and use it in GitHub Desktop.
Save abouolia/27d103c5c33ca860f353d12c8252f607 to your computer and use it in GitHub Desktop.
Fix: Visual Composer full width row with RTL.
<?php
/**
* This function fixes full width row of Visual Composer plugin with RTL view.
*
* IMPORTANT NOTE: You should add this script after jquery.js and before js_composer_front.js
*
* @return void
*/
function website_vc_full_width_rtl_inline_script(){
// Can't continue if the current view is not RTL.
if( ! is_rtl() ) return;
?>
<script type="text/javascript">
jQuery(document).ready(function(){
function vc_single_row_full_width_rtl(event, data){
data.el.css('right', data.offset).css('left', 'auto');
}
jQuery(document).on('vc-full-width-row-single', vc_single_row_full_width_rtl);
});
</script>
<?php
}
add_action('wp_footer', 'website_vc_full_width_rtl_inline_script');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment