Can’t Get Translated Short Description on Structured Data
-
First of all, congratulations and many thanks to Mr. Ofer Wald for sharing this beautiful plugin.
Please, if possible I would kindly ask you about a problem I encountered in the structural data from the Woocommerce product pages, that I have been trying to solve for many days without success.
I don’t use any schema plugin, and Testing the woocommerce built-in structural data of the page via google tool, the short description, the url, and the product id, all refer to the page in the original language.I’m not sure if this is the right way, but I tried to fix the problem by editing the class-wc-structured-data.php file:
As for the url and product id, I have apparently corrected the problem by adding the variable:
$ current_url = set_url_scheme (‘http: //’. wp_unslash ($ _SERVER [‘HTTP_HOST’]). wp_unslash ($ _SERVER [‘REQUEST_URI’]));
and replacing:
// ‘url’ => $ permalink,
with:
‘url’ => $ current_url,Regarding the short description, despite numerous attempts, I always get the description in the original language.
The page is correctly translated, in fact, by adding the belove code to the header.php file of my theme, I can get the short description in the translated language at the top of the product page.
global $ post;
$ short_description = apply_filters (‘woocommerce_short_description’, $ post-> post_excerpt);
echo $ short_description;Please, why with the above code inserted in the header.php file I get the short description translated, while I get the short description in the original language when inserted in the file class-wc-structured-data.php?
I apologize if the question may be trivial for many, and thank you for your attention and your time.
Regards
- The topic ‘Can’t Get Translated Short Description on Structured Data’ is closed to new replies.