Wordpress qtranslate plugin doesn't translate navigation menu - php

I am working on one Wordpress website. We use twentyeleven theme. Site is available in 3 languages, Czech, English and Russian. For translations we use qTranslate plugin for Wordpress qTranslate plugin .
In the beginning we didn't have any problems with translations. But after some time qTranslate stopped translate navigation menu items. We have 3 menus and each of them has specific items. If I don't select main navigation menu in theme properties then translation works, but all menu items from 3 menus are shown in one big menu, which is not good. If I choose one of these 3 menus as main, then translation stop working. The weird thing is that only menu items don't translate, other parts of website (articles, headers, links) are translated properly.
Have you ever had this kind of problem with this plugin ?

My approach to multilanguage menus in wordpress was:
In the header.php theme file:
<?php wp_nav_menu( array(
'theme_location' => 'top_menu',
'menu' => 'Menu ' . substr(get_bloginfo ( 'language' ), 0, 2) ,
'menu_id' => 'mainnav',
'sort_column' => 'menu_order',
)); ?>
Then I've created different menus for each language:
The function I've used get_bloginfo returns the locale in the qTranslate section:
It worked for me. Add suggestions or other plugins to turn this into an easy task.

I had the same problem.
In WordPress Dashboard check in Appearance -> Menu under Menu Structure.
Click the arrow on the right of the item to reveal additional configuration options and check if Navigation Label names are different when you change languages with q-translate if not add your own translations.
Hope that helps.

Related

Creating a second header navigation menu in Wordpress

I would like to create a second navigation menu that goes below the main one (The one that contains the "About" and "Contact" etc. categories). This one would have images that have links and also which show text under them when hovered on. I have already created the necessary HTML and CSS for it, I just don't know how I would implement that into my site. The images and links are in a table, but the Wordpress navigation menu is a list, so I'm kind of stuck on what to do.
Are you using a default/premium/free theme, or did you create one by yourself?
I assume the first, so here are a few things you need to know.
Wordpress uses hooks, so you can "link" your code at a certain point of their code, when a website is called. In its codex, you can learn more about how navigation menus are registered and called later on.
A theme is something like a base, when you create your own website. You can create child themes and implement every further functionality and design changes
right there.
In short: implement your menu, put it in your child theme and use the hooks to get it where you need.
Standard way of adding a secondary menu to a theme is as follows.
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'yourtheme'),
'secondary' => __( 'Secondary Menu', 'yourtheme' ),
) );
Nevermind, the question I was trying to ask is where do I put my HTML code of the table so that it shows up on the header, but I found the solution through sheer luck. I put the HTML into the header.php of my child theme and linked the CSS classes to those that I pasted into the style.css . Still, thanks to those who tried to answer!

How to Disable Wordpress Default Widget in one SideBar

I have developed a Premium theme, but as soon as theme is installed wordpress by default throw some of its widgets in Header Area.
The theme looks very ugly at it first appearance when it is virgin w/o all the theme settings.
Although those widgets can be deleted mannualy from the Widget area of Header, but initially the buyer of that theme wouldn't get a Good Notion.
I want to disable wordpress few default widgets in one particular side bar.
I tried various things and researched on various forums.
I got few solutions such as : WordPress widgets can be completely disabled, but that what I do not want.
Has any one faced the same challenge like me. Please advice.
Summary of The Question: I want to disable wordpress default widgets in only one particular sidebar/widget area.
Thanks!
register a custom area for your header
function theme_widgets_init() {
register_sidebar(array(
'name' => __('Header widget', 'theme'),
'id' => 'sidebar-1',
.............
.............
));
add_action('widgets_init', 'theme_widgets_init');
and output it in your header like that:
<?php dynamic_sidebar('sidebar-1'); ?>

How to make mutilevel menues in wp custom theme?

I have integrated html page in wp ,but problem arises when I tried
to display wp menus. I have also created multilevel menus in wp-admin. I have used below method to display menus .
wp_nav_menu( array( 'theme_location' => 'main-menu' ) );
what should i do ,to display multilevel menues in custom pages with their style
you can directly use this plugin
https://wordpress.org/plugins/multi-level-navigation-plugin/screenshots/

How to insert secondary menu on TwentyThirteen theme in WordPress?

I am currently using Twenty Thirteen theme and I want to create a secondary menus. I am not entirely familiar with the PHP codes. I was wondering if you know how to insert the proper code in function.php? Also, do you know the code to insert in header.php page?
Here is the example of codes from Twenty Eleven theme:
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'yourtheme'),
'secondary' => __( 'Secondary Menu', 'yourtheme' ),
) );
<nav>
<?php
wp_nav_menu( array('container_class' => 'menu-footer',
'theme_location' => 'secondary') ); ?>
</nav>
Thanks!
by secondary menu, i assume you mean a sub menu? this is done in the wordpress cms. first create the pages, then go to the menu module and add them to the primary menu you have already set up. then they will appear with when you call the menu. you will have to stylize them in css to get them to be a nav bar and there are tons of tutorials and already answered questions on that.
if you are creating a second separate menu, then you are on exactly the right track with registering the menus. but then you want to call them with the wp_nav_menu() in different places, unless you want to join the menus, which you can do by placing <ul></ul>around the php code.
always actually create the pages and menu wordpress and once you register it, be sure to go back in to the menu and link the menu to the location under the manage location tab. check codex if you don't know what i mean. you may have forgotten that step. good luck!

How to list only english custom menus in a metabox alike the Custom Menu widget?

I'm currently developing a custom theme for Wordpress which also uses WPML. One of the features is a page independent "Quick navigation menu" that resides in the sidebar of pages.
My approach is to use custom menus (Appearance->Menus) for this. On Edit Page screens I want to include a metabox with a dropdown for selecting the right menu. Creating the metabox is easy:
function page_menus_meta(){
add_meta_box('page_menusid', 'Quick navigation menu', 'page_menus_metabox', 'page', 'normal', 'high');
}
add_action( 'add_meta_boxes', 'page_menus_meta' );
The problem is in displaying the available menus. It must be possible, since the widget "Custom Menu" exists and does exactly that. But when I list all menus I also get the menus translated by WPML which I do not want. I use..
$menus = get_terms('nav_menu');
..for displaying the menus.
My question: How do I list all english-only menus alike the Custom Menu widget?
Subquestion: If someone knows where the code for the Custom Menu resides in the WordPress core I might figure it out myself. Can't seem to find the file though..

Categories