Home › Forums › All Other Themes › Shortcode in sidebar.php + translations
- This topic has 8 replies, 3 voices, and was last updated 7 years, 3 months ago by
Forum Moderator.
-
AuthorPosts
-
June 18, 2016 at 3:31 pm #37568
Hello, I’m using the restaurant theme and I’m trying to add translations lines with qTranslate tags (e.g. [:en]) in the sidebar.php file to modify the opening hours widget.
Not being proficient in php I’m struggling to have it working as php just prints out everything, including qTranslate tags.
How can I solve it please?
Thank you.June 20, 2016 at 5:07 am #37670Hi Pier,
Kindly show us your website URL.
Regards,
DaveJune 20, 2016 at 11:21 am #37739The website is
www.alvoloitalianstreetfood.co.uk
and the page where the issue happens is:
http://www.alvoloitalianstreetfood.co.uk/it/contact-page/
Basically by using the page template “Left Sidebar” for that page the “sidebar.php” page has a php script:<?php if ( ! dynamic_sidebar( 'sidebar-main' ) ) : ?> <aside id="archives" class="widget"> <h3 class="widget-title">Opening Hours</h3> <?php echo do_shortcode('[time_table] [time_table_row title="Monday" start="10:00 am - to - 08:00pm"]
which doesn’t allow me to add [:en] tags.
June 20, 2016 at 11:38 am #37747Hi Pier,
Your website is in maintenance mode.
Regards,
DaveJune 20, 2016 at 11:38 am #37748Hi Pier,
Your website is in maintenance mode.
Regards,
DaveJune 20, 2016 at 11:38 am #37749Erm, yes, I’m building it. 🙂
June 20, 2016 at 12:11 pm #37756Hi,
You are not supposed to paste shortcode of multiple language within file but you are supposed to add it in widget.
Please check tutorials of qTranslate X for this.
Regards,
ShriJune 20, 2016 at 12:54 pm #37768Fair enough, my bad…
I’ve solved it by allowing shortcodes in widgets by adding a line in functions.phpadd_filter('widget_text','do_shortcode');
ref:
http://www.wpbeginner.com/wp-tutorials/how-to-use-shortcodes-in-your-wordpress-sidebar-widgets/June 21, 2016 at 5:32 am #37837Alright
-
AuthorPosts
- You must be logged in to reply to this topic.