I am developing a multi language site with word press and wpml.
My problem is-
i have a link of a page(site.com/xyz) in a button in editor of a page which is in English. If i am in Spanish version of that page and and click that link(site.com/xyz) that goes to the English version.I want that goes to the Spanish version(site.com/es/xyz) of that page automatically instead of going to English version.(site.com/xyz).
Can anyone expert me out from it?
I hope i get some help from here.
Thanks
You need to use below the code for link
$url = get_the_permalink();
$wpml_permalink = apply_filters( 'wpml_permalink', $url , ICL_LANGUAGE_CODE );
site.com/xyz
Related
I'm using WordPress with Gravity Forms and I have problems with showing the Submit button with special characters such as ÅÄÖ.
I have UTF-8 set as charset, I have checked with my hosting company and they say that the UTF-8 is set and I have been in contact with GF Support with no luck. This is how it looks:
I have tried in the normal TwentyTwenty theme and there it works, so it has to be something in the theme. Since I'm the creator of the theme I can't contact someone else and really don't know what in the theme I should change. Does anyone know?
I solved it now.
The problem was in the GF function which transformed the submit button to a button. I added:
$dom->loadHTML( '<?xml encoding="utf-8" ?>' . $button );
And it worked!
I have a question. I am using WPML plugin. In WPML->languages->Language switcher options i checked "Link to home of language for missing translations". Now when i click language switcher country flags and translation is missing it will redirect to homepage. My question is how to redirect to custom page when translation is not found. I want to create page with text "Sorry translation is missing. Please contact us for more info..."
Thank you for your time
First make sure you have WPML->languages->Language switcher options "Link to home of language for missing translations" checked. Then create your custom translation not found page in main language and translate it to other languages using WPML. Then add this code to your functions.php
add_filter('wpml_ls_language_url', 'redirect_link',10,2);
function redirect_link($url,$lang){
if($lang['missing'] == 1) {
$permalink_to_translation_not_found_page_in_main_language = get_the_permalink(40); //40 is page id of a custom translation not found page in main language
$lang['url'] = apply_filters( 'wpml_permalink', $permalink_to_translation_not_found_page_in_main_language , $lang['language_code'] );
}
return $lang['url'];
}
I hope this is useful for someone
This is question on the seo yoast wordporess plugin.
I have a friend who doesn't know that much about code/wordpress/etc, they have an ecommerce site built using magento and a blog using wordpress which is styled to match the main site and they use yoast seo plugin for seo etc. They have asked me to try an get the breadcrumbs working for them in a different way to what i know, from what i can see they want to add a prefix to the breadcrumbs 'home' which links to main site then renaming the blog from home to blog, for example home(main site) > blog(blog) > post.
Now i did just that in the plugin settings but they said that the schema markup wouldn't be complete and said there’s a filter hook called ‘wpseo_breadcrumb_links’ which gives access to the array of URLs and anchor text used to build the breadcrumbs, now i cant find anything on google that explains this or how to start writing it, i do know that it needs to go in the functions file.
Would it be possible to get some help on this.
Thanks in advance and very much appreciated.
Justin
I'm not sure what Schema.org markup has to do with breadcrumbs! :) Schema is used on post/page level. So, they are either oversmarting themselves or I got you wrong.
I think this sample code may be helpful:
add_filter( 'wpseo_breadcrumb_output', 'custom_wpseo_breadcrumb_output' );
function custom_wpseo_breadcrumb_output( $output ){
if( is_product() ){
$from = '<span typeof="v:Breadcrumb">Products</span> »';
$to = '';
$output = str_replace( $from, $to, $output );
}
return $output;
}
It looks like wpseo_breadcrumb_output gives you access to the entire output instead of just the link portion. Please see this page for more details: http://wpquestions.com/question/showChrono/id/8603
http://www.mytwins.gr/site/
In the third blog post you will see that a shortcode shows up [frame align="none"]Της Εύης Σταθάτου[/frame] which is ugly. Only if you click it, it works fine.
Why is that?, How can you hide the code from the previews posts thingy? Thanks in advance.
P.S I tried to hide the shortcode from the visual mode and enter it in the text mode, but still the same.
As #Ravi suggests, make sure that your plugins are enabled. However, it looks like your shortcodes are appearing within your excerpts (assuming you're using the_excerpt() for the snippets appearing on your homepage?)
I would suggest a handy snippet of RegEx:
$myExcerpt = get_the_excerpt();
$myExcerpt = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $myExcerpt);
echo $myExcerpt;
That should stop the raw shortcodes from appearing.
I'm not sure if I titled this correctly but this is my issue, I have to create 2 same exact blogs and the only difference is language. So but what I need is at the top when clicked on a language it would take the user to that same page but in the language he/she clicked on.
I'm using permalinks currently and I've tried the following:
<?php
function my_permalink() {
echo substr(get_permalink(), strlen(get_option('home')));
}
my_permalink();
?>
but that for some reason on my home page points to a post and not the home page. I believe that works in posts but I need that to also work on the home. Here's the links to both blogs, any help is much appreciated..
English: http://www.inblu.pe/prblog/
Spanish: http://www.inblu.pe/prbloges/
It could be more simple with standard PHP method :
$_SERVER["REQUEST_URI"]
Of course it will work for current post only.
You can also use that :
<?php
function my_permalink() {
echo substr(get_permalink(), strlen(home_url('/')));
}
my_permalink();
?>
How about the_permalink? I'm fighting with that now.
~ Justin