Title: soylug's Replies | WordPress.org

---

# soylug

  [  ](https://wordpress.org/support/users/soylug/)

 *   [Profile](https://wordpress.org/support/users/soylug/)
 *   [Topics Started](https://wordpress.org/support/users/soylug/topics/)
 *   [Replies Created](https://wordpress.org/support/users/soylug/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/soylug/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/soylug/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/soylug/engagements/)
 *   [Favorites](https://wordpress.org/support/users/soylug/favorites/)

 Search replies:

## Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/translating-links/page/2/#post-4124815)
 * solved first question
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/translating-links/page/2/#post-4124814)
 * Thanks a lot, but finally I couldn’t get it working, so I gave up woocommerce.
   I set as resolved as you did solve my first question 😉
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/page/2/#post-4124800)
 * Nice!
    I changed what you said and now i get “i’m here A with id: 564 i’m here
   B with id: 678 i’m at c” as answer, so I can continue working. Thanks a lot!!!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/page/2/#post-4124798)
 * I’m still trying to solve this… I’m usin print_r as suggested and I get something
   I think is strange. For this piece of code:
 *     ```
       add_filter('woocommerce_get_checkout_url', 'pll_woocommerce_get_checkout_url');
         function pll_woocommerce_get_checkout_url(){
       	$checkout_page_id= woocommerce_get_page_id('checkout');
       	print_r("  i'm here A with id: ");
       	print_r($checkout_page_id);
       	$checkout_page_id_lan = pll_get_post ($checkout_page_id);
       	print_r("  i'm here B with id: ");
       	print_r($checkout_page_id_lan);
       	print_r ("  i'm at c");
       }
       ```
   
 * I get “i’m here A with id: 564 i’m here B with id: i’m at c” as answer, so Polylang
   is not translating the id… should it work?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/page/2/#post-4124787)
 * Thanks, but nothing changed… It works but without pll_get_post, so I always get
   the same language.
    Now I’m trying this:
 *     ```
       add_filter ('woocommerce_get_checkout_url', 'redirect_checkout_page_translated');
       function redirect_checkout_page_translated() {
       	if ( pll_current_language() == 'es'){
       		$url = 'http://www.xxxx'; //spanish link
       		}
       	else if ( pll_current_language() == 'en'){
       		$url = 'http://www.yyyy'; //english link
       		}
       	else{
       		$url = 'http://www.zzzz'; //other page
       	}
       	return $url;
         }
       ```
   
 * I’ve tried all options (name, slug, locale) but doesn’t work. The las else is
   a default one because it seemed like pll_current_languge didn’t match options.
   Whith the code above, it always returns the default option (‘[http://www.zzzz&#8217](http://www.zzzz&#8217);).
   I have two languages, english and spanish, so I can’t understand what is pll_current_language
   function returning…
    I’m feeling silly and also becoming crazy 🙁
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/#post-4124785)
 * I’m stuck with this 🙁
    What I’m trying to do now is this:
 *     ```
       add_filter ('woocommerce_get_checkout_url', 'redirect_checkout_page_translated');
       function redirect_checkout_page_translated() {
       	$page_id = get_page_by_title('checkout');
       	$page_id_lan = pll_get_post ($page_id);
       	$url = get_permalink ($page_id_lan);
       	return $url;
         }
       ```
   
 * but doesn’t work… If I don’t use pll_get_post, just this:
 *     ```
       add_filter ('woocommerce_get_checkout_url', 'redirect_checkout_page_translated');
       function redirect_checkout_page_translated() {
       	$page_id = get_page_by_title('checkout');
       	$url = get_permalink ($page_id);
       	return $url;
         }
       ```
   
 * it redirects ok (I have try with several posts). I had understood that pll_get_post
   function works with ids, so it should work… or not?
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/#post-4124782)
 * When I say it doesn’t work, I mean that redirects to the same page but appears
   white (doesn’t load). If I comment the “add_filter(‘woocommerce_get_checkout_page_id’,‘
   pll_get_post’);” it returns the page in the main language.
    There is a plugin
   to get woocommerce working with wpml and I downloaded it to have a look in case
   I can find out something I could use, and it uses this function in the filter(
   for cart page, for example):
 *     ```
       function translate_pages_in_settings($id) {
       		return icl_object_id($id, 'page', true);
       	}
       ```
   
 * I saw on your web that this is as pll_get_post. But for checkout page, their 
   function is this one:
 *     ```
       function get_checkout_page_url(){
               return get_permalink(icl_object_id(get_option('woocommerce_checkout_page_id'), 'page', true));
           }
       ```
   
 * I’m telling this just in case you can see a solution
    Thanks a lot
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/#post-4124781)
 * Nop, that doesn’t work 🙁
    It does for the cart page, but not for this one…
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/#post-4124779)
 * Thanks again!
    Here is the code for get_checkout_url:
 *     ```
       /**
       		 * Gets the url to the checkout page.
       		 *
       		 * @return string url to page
       		 */
       		public function get_checkout_url() {
       			$checkout_page_id = woocommerce_get_page_id('checkout');
       			$checkout_url     = '';
       			if ( $checkout_page_id ) {
       				if ( is_ssl() || get_option('woocommerce_force_ssl_checkout') == 'yes' )
       					$checkout_url = str_replace( 'http:', 'https:', get_permalink( $checkout_page_id ) );
       				else
       					$checkout_url = get_permalink( $checkout_page_id );
       			}
       			return apply_filters( 'woocommerce_get_checkout_url', $checkout_url );
       		}
       ```
   
 * I had already thought about sharing results (if I/we manage to get it working).
   As I said I’m not a programmer, so everything I try to change takes a lot of 
   time for me 🙁
    I also used it for nextgen plugin, which I guess is also interesting
   for more people. I’ll share, be sure 😉
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/#post-4124774)
 * Hi again! Your advices were very useful and I have solved many things doing what
   you told me, but there is a page which I can’t get working and don’t know why!
   
   It’s again about woocommerce plugin, for a page already translated. Is the same
   that I first asked but this time there is something different that I suppose 
   is what is messing things.
 *     ```
       // filter hook for include new pages inside the payment method
       $get_checkout_url = apply_filters( 'woocommerce_get_checkout_url', $woocommerce->cart->get_checkout_url() ); ?>
   
       <form name="checkout" method="post" class="checkout" action="<?php echo esc_url( $get_checkout_url ); ?>">
       ```
   
 * I’ve already added a filter as you said:
 *     ```
       add_filter('woocommerce_get_checkout_url', 'pll_get_checkout_url');
       function pll_get_checkout_url($link) {
           return pll_get_post($link);
       }
       ```
   
 * but doesn’t work, this time it returns main language page. Then, if I change 
   language (clicking on the flag) I get the page in the language selected, so they
   are linked but filter isn’t working.
    Thanks for your help!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/#post-4124747)
 * Just one more question (hope last one). NextGEN Gallery plugin can link galleries
   to pages. When calling the link, it allways return the same page in the same 
   language although there is a translation for it. More or less is the same than
   before, but the calling is:
    pageid); ?>”> Can I do something similar? Thanks!
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/#post-4124746)
 * Perfect!! Thanks a lot!! I guess that I can do the same for other pages if I 
   have the same issue.
    Thanks!! ^_^
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Polylang] Translating links](https://wordpress.org/support/topic/translating-links/)
 *  Thread Starter [soylug](https://wordpress.org/support/users/soylug/)
 * (@soylug)
 * [13 years ago](https://wordpress.org/support/topic/translating-links/#post-4124704)
 * First of all, thanks for your answer, nice support!
    This is what I could see:‘
   cart_url’ => get_permalink( woocommerce_get_page_id( ‘cart’ ) ) And the function
   is: ‘function woocommerce_get_page_id( $page ) { $page = apply_filters(‘woocommerce_get_’.
   $page . ‘_page_id’, get_option(‘woocommerce_’ . $page . ‘_page_id’)); return (
   $page ) ? $page : -1; } }’ Do you think it can be solved in an easy way? I’m 
   sorry, I’m not a programmer 🙁 Thanks

Viewing 13 replies - 1 through 13 (of 13 total)