Form link throwing website to main language

Question

So this theme (Listeo) I’m using it’s not natively multilang, so support doesn’t help on this and I had to make some customization in the code.
Every time I’m on the second language (English), and I press a link in the costumer dashboard, it’ll open that page but in the main language.

I was able to temporarily fix those menus in this personalized dashboard using this:

– Daclared this (found it on google)

    $icl_object_id = icl_object_id($dashboard_page, 'page', true);

– And for the links this

    <a href="<?php echo get_permalink($icl_object_id); ?>"><?php esc_html_e('Dashboard','listeo');?></a>

But I’m not being able to fix it in a widget form. If I press the button called “Request Booking” it sends me to the correct page but in a different language (Main one = Portuguese).

The code in this form is the following:

    <input type="hidden" id="listing_type" value="<?php echo $post_meta['_listing_type'][0]; ?>" />
    <input type="hidden" id="listing_id" value="<?php echo $post_info->ID; ?>" />

    <input id="booking" type="hidden" name="value" value="booking_form" />
    <?php if(is_user_logged_in()) :
        if ($post_meta['_listing_type'][0] == 'event') { 
            $book_btn = esc_html__('Make a Reservation','listeo_core'); 
        } else { 
        if(get_post_meta($post_info->ID,'_instant_booking', true)){
            $book_btn = esc_html__('Book Now','listeo_core');   
        } else {
            $book_btn = esc_html__('Request Booking','listeo_core');    
        }
    }  ?>

    <a href="#" class="button book-now fullwidth margin-top-5"><div class="loadingspinner"></div><span class="book-now-text"><?php echo $book_btn; ?></span></a>

Any idea how can I make this call the requested options but keeping in the selected language?

I’m using latest wordpress version, polylang and loco translate.
Thank you in advance.

0
, , dbcstrauss 3 years 2019-12-05T06:35:06-05:00 0 Answers 100 views 0

Leave an answer

Browse
Browse