Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter ancrerouge

    (@ancrerouge)

    I forgot to say that i want to get the url to display in the hreflang tag.

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    To be sure I understand correctly, you would like a function that can only give you the translation URL instead of displaying it as a link?

    I am very busy over the next two weeks preparing and going on a trip to Asia, so I am not sure when I will be able to add this. But I will try to add it as soon as I can.

    Thread Starter ancrerouge

    (@ancrerouge)

    Thank you for your answer.

    I made a function that worked, but I do not know why it does not work since the last update (i’m not developer) :

    function displayBilingualLinkerURL(){
    	ob_start();
    	the_bilingual_link();
    	$urlString = ob_get_clean();
    	$pregStr = "#<a href='(.*)'>(.*)</a>#";
    	preg_match($pregStr, $urlString, $bUrl);
    	echo $bUrl[1];
    }
    Thread Starter ancrerouge

    (@ancrerouge)

    Sorry : since the update, the simple quotes became double quotes. So my soution is :

    function displayBilingualLinkerURL(){
    	ob_start();
    	the_bilingual_link();
    	$urlString = ob_get_clean();
    	$pregStr = '<a href="(.*)" >';
    	preg_match($pregStr, $urlString, $bUrl);
    	echo $bUrl[1];
    }

    Have a good trip in Asia !

    Plugin Author Yannick Lefebvre

    (@jackdewey)

    I just released a new version of Bilingual Linker that adds an option to output only the URL. To use this new option, you must use the_bilingual_link function with an array instead of individual arguments:

    the_bilingual_link( array( ‘url_only’ => true ) );

    Should do the trick and let you remove all of that output buffer code. Let me know if this works for you.

    Thread Starter ancrerouge

    (@ancrerouge)

    Thank you very much,
    I just saw your post and make the changes. It works very well. Now hreflang tags displayed correctly, thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display the URL’ is closed to new replies.