wordpress sidebar content in different languages - php

I am developing a site in wordpress.I want the particular page from the site in four different languages(English,spanish,french and Dutch).I have used a plugin called WP Native Dashboard.Using this I am able to get the page content in four different languages.I used the combobox to select the language and display the content.This works fine...
I am creating a new page,select the language ,and writing the content in it.For same content in different language i am just writing the page id besides the language name as follows :
Main problem is about the sidebars,footer and the header content.I have one set of sidebar,footer and header in English language.When I select the different language (for example french) the sidebar,footer and header content is displayed in English.
If i try to create another set of sidebar,footer and header in other language and try to create a diffrent page called French left sidebar .In french content if i select the page as shown below:
.and on the site when i select the language as english sidebar content displayed in french language .
so my question is how to get the sidebar content in different language when different language from the combobox are selected.

Create a new page template that loads a custom sidebar. Also checkout http://wpml.org/2011/06/how-to-build-different-sidebars-per-language/

Related

How to resolve the WPML translation issue on website?

I have one site in WordPress + DIVI + WooCommerce + WPML and other plugins.
I am facing one issue on site while WPML Translation.
Website is in 3 languages:
Dutch (Main)
Franch
English
I need to keep different string for different language for the button text in one module of the DIVI.
I selected English language from adminbar
When I go to Theme Builder -> Global Header and I change the button text to "XYZ", it is reflecting only on English page, that is fine.
Now when I change the language to Dutch
and When I go to Theme Builder -> Global Header and I change the button text to "ABC", then it is reflecting on Dutch and French pages (English page is fine with "XYZ"), this must reflect on Dutch page only If I change the button by selecting the Dutch language
Now when I change the language to French
and When I go to Theme Builder -> Global Header and I change the button text to "DEF", then it is reflecting on Dutch and French pages (English page is fine with "XYZ"), this must reflect on French page only If I change the button by selecting the French language
I checked for String Translation, and updated translation for Dutch and French but it is not reflecting on front side.
When you're switching languages and modifying it manually like this, you are messing up the WPML logic that's handling translations. Page builders are tricky to translate. That's why you need to follow the recommended process.
From documentation:
To translate the Divi site header or footer you created using the Divi
Theme Builder, follow these steps:
Go to WPML > Translation Management. Choose Header Layout, Footer Layout, or Body Layout from the Type dropdown, then click the Filter
button.
Choose which headers or footers you want to translate, the languages you want to translate them into, and click Translate
selected content.
Go to WPML > Translations to take and translate the global header using the Advanced Translation Editor.
Try this with a fresh site with a new global Divi header/footer from scratch.

Bilingual Wordpress Website [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I am developing a wordpress website and I would like to have two instances of the website, one in english and the other in german. My goal is to when a user visits my website, the user is redirected to the correct language, based on his/her browser language. But I want to do this with only one instalation of wordpress. I can make duplicates of the pages (one in english and other in german), make a homepage duplicate by setting the homepage as a template for pages. My issue is the menu. How do I set different menus to different pages?
You'll need to register a new navigation menu, and add it to the templates you are using for the German pages, then make a new header template, then set your templates to use that new header. Here's the steps needed to do this:
Register the menu
In your theme's functions.php, you'll need to add some code like this at the end of the file:
function register_german_menu() {
register_nav_menu('german_menu',__( 'German Menu' ));
}
add_action( 'init', 'register_german_menu' );
What this does is tells Wordpress that you want to add a new location for a menu to be customised in the Appearance > Menus page. You should from now be able to add items to your menu, but they won't show up anywhere yet.
Create some page templates
You will have to create a set of page templates for the German half of the site. You will need a new page.php and a new header.php template. I would recommend calling these page-german.php and header-german.php respectively. For your page-german.php, copy paste the page.php template into page-german.php, and add this comment at the top of page-german.php:
<?php /* Template Name: German Page Template */ ?>
This tells WordPress to recognise it as a page template, and tells it it's name. This makes the template selectable on each individual page.
Now, you need to make a header template. Copy paste the header.php template into the header-german.php. In this new template, look for a line that looks something like
wp_nav_menu(array('theme_location'=>'something'))
And change it to:
wp_nav_menu(array('theme_location'=>'german_menu'))
This will display the German menu instead of the regular menu.
Now, go back to page-german.php and look for the line that looks like:
<?php get_header(); ?>
And change it to:
<?php get_header('german'); ?>
This tells Wordpress that on this page, you want to use the header-german.php file to generate the header rather than header.php.
Setting up page templates and Menus
First, go to the Appearance > Menus tab, and create a new menu, then assign that new menu to the slot "German Menu". Then, you will need to go through all the German pages of your site, and in the right sidebar when editing, set the page template to "German Page Template". Now your pages using the new template will display the German menu instead of the English one!
Further?
If you have other templates that need converting, then you can convert them as described above, by making a copy and changing the get_header() call. I didn't really expect this answer to be this long but I hope it helps!
You can use a plugin like WPML to achieve this but if you dont want to use a plugin, you can edit header.php and add a condition on which menu to load depending on the browser language.
e.g.
<?php
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
switch ($lang){
case "en":
//display english menu
break;
case "de":
//display german menu
break;
default:
//default to english or german menu
break;
}
?>
Above code was taken from: Detect Browser Language in PHP

How to get seo friendly article url in joomla without assiging it to any menu

I am a wordpress developer and new for Joomla cms. Currently i am working on a Joomla project.
I have created articles from admin section and i want to call those articles in my front end with seo friendly url(http://www.example.com/article-alias) without assigning it any menu.
I am already using url like this /index.php?option=com_content&view=article&id=article_id to get article in front end.
Thanks in advance for any suggestion or solution.
In my Joomla instance I created a new menu called "blank" to put any articles I wanted to link to directly instead of adding them to the navigation on the site. I assigned my articles to that menu, and there is a field called "alias", manually type in the name you want to appear in your URL (like article-alias). Then you can link directly to that page with example.com/article-alias. This will also allow you to add modules to the page from the module manager and selecting your articles from the "blank" menu.

Magento URL translation for CMS pages names

I build the store with 2 views for two languages French and English and I have many CMS pages, like "about us" in English and the same page in French - "a propos".
In administration side the option "Add Store Code to Urls" is ON.
I have created 2 CMS pages "about-us" linked to English store view and another one "a-propos" linked to French store view.
When I’m in English store on "About us" page the URL is www.myurl.com/en/about-us/ but if I switch the language to French the language switcher brings me to www.myurl.com/fr/about-us/ instead of www.myurl.com/fr/a-propos/
So, the language switcher changes only the store code but not the page name.
Thank you,
Yes, this is how magento works. If you want to change to another static block on your about page in some language you have to change the reference to the block id "about-us" to "a-propos" on the french site.
This page explains this quite good I think.
http://anothermarketer.com/how-to-translate-a-magento-theme/
Just add a comment to my answer if you need more help.

Displaying Custom Content On Different Pages All Using The Same Template

This is my first Wordpress build so bear with me whilst I try to explain the issue.
I'm building a site for a hotel. 3 of the pages of the site all feature the same content (a heading, a paragraph of text and a gallery) and all feature a 'box', the content of which differs slightly from page to page. For example, on the 'accommodation' page the box will simply have paragraph text in, but on the 'restaurant' page the box will have links to downloadable PDF menus.
I've built a custom template file for these pages called 'standard-page'. My question is, what would be the best way to tackle this box issue? I'm guessing there is an easier way than creating a separate template for every page? The box does need to be content editable, so for each page the backend fields will differ (the restaurant page will require a file upload facility for example).
I've been following a Treehouse tutorial so far, but this isn't really covered in it. I've been using Custom Fields if that helps.
The only idea I can think of is having the box as a separate file (e.g. content-box) and having a WP_Query which calculates and displays different fields based on the page.
Here is an example of the different style boxes. The one with the offer is for the homepage.
using a content-box.php would probably be your best bet and inside it - target the pages by name.
inside of the content-box.php:
<?php if(is_page('accommodation')) {//show accommodation box}?>
<?php elseif(is_page('restaurant')) {//show restaurant box }?>
etc.

Categories