get direction in opencart

Well many times i get this error  – Notice: Undefined variable: direction

after using code like this

if ($direction == 'rtl') { echo 'أخبار الموقع'; } else { echo 'News'; }

the soultion is go to here in your opencart site:


open page:


add this line :

$this->data['direction'] = $this->language->get('direction');

and your are done


display custom filed using do_shortcode in template

today i needed t o display contact form 7 Shortcode into a template

when it was pulled from custom field in the admin panel

so here is the snippets

<?php // echo do_shortcode(‘[contact-form-7 id=”1067″ title=”landing page”]’);?>

//change “lp_cf7” to the name of your custom field.
$key = ‘lp_cf7’;
//if the field is set within wordpress, continue
if (get_post_meta($post->ID, $key, true)) { ?>
<?php echo do_shortcode(get_post_meta($post->ID, $key, true));?>
<?php }?>