Shortcode in sidebar.php + translations

Home Forums All Other Themes Shortcode in sidebar.php + translations

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #37568
    PierPier
    Member
    • Topics: 1
    • Replies: 3
    • Total: 4
    Member since: June 6, 2016

    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.

    #37670
    Sonnal S SinhaSonnal S Sinha
    Moderator
    • Topics: 0
    • Replies: 30588
    • Total: 30588
    Member since: August 16, 2013

    Hi Pier,

    Kindly show us your website URL.

    Regards,
    Dave

    #37739
    PierPier
    Member
    • Topics: 1
    • Replies: 3
    • Total: 4
    Member since: June 6, 2016

    The 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.

    #37747
    Sonnal S SinhaSonnal S Sinha
    Moderator
    • Topics: 0
    • Replies: 30588
    • Total: 30588
    Member since: August 16, 2013

    Hi Pier,

    Your website is in maintenance mode.

    Regards,
    Dave

    #37748
    Sonnal S SinhaSonnal S Sinha
    Moderator
    • Topics: 0
    • Replies: 30588
    • Total: 30588
    Member since: August 16, 2013

    Hi Pier,

    Your website is in maintenance mode.

    Regards,
    Dave

    #37749
    PierPier
    Member
    • Topics: 1
    • Replies: 3
    • Total: 4
    Member since: June 6, 2016

    Erm, yes, I’m building it. 🙂

    #37756
    Sonnal S SinhaSonnal S Sinha
    Keymaster
    • Topics: 10
    • Replies: 6964
    • Total: 6974
    Member since: June 12, 2013

    Hi,

    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,
    Shri

    #37768
    PierPier
    Member
    • Topics: 1
    • Replies: 3
    • Total: 4
    Member since: June 6, 2016

    Fair enough, my bad…
    I’ve solved it by allowing shortcodes in widgets by adding a line in functions.php

    add_filter('widget_text','do_shortcode');
    ref:
    http://www.wpbeginner.com/wp-tutorials/how-to-use-shortcodes-in-your-wordpress-sidebar-widgets/

    #37837
    Sonnal S SinhaSonnal S Sinha
    Moderator
    • Topics: 0
    • Replies: 30588
    • Total: 30588
    Member since: August 16, 2013

    Alright

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.