![]() If you would like to show a different menu (with different options) for logged in users, you could do the following: Different Menus for Different LanguagesĪnother common request is to have the ability to show different menus for different languages on your site.Īgain, the below example will need to be modified and added to your header.php or footer. The custom options mentioned earlier are easily used by simply attaching them to the shortcode as below: ĭoing the above is a great way of customising the menu for individual pages, as you can change the menu title to something different on blog pages to actual pages.ĭoing the below you can change the menu that is used by the plugin entirely. You can either use the shortcode in your pages by simply placing the text or in your pages depending on which version you have installed, alternatively you can include this directly in your template files (usually inside header.php) as below: Īnd for the pro version: Using custom options Using the shortcode is done the same as any other shortcode in WordPress and you can find out more about them from the WordPress pages by clicking here. Using Arguments you can display specific posts based on their. This will overwrite the menu_to_use option above. The Display Posts Shortcode allows you to add a list of your blog posts to different pages. These options will apply to all language switchers on your site. To do this, go to WPML Languages and scroll to Language switcher options. The option to turn the Shortcode on can be found in the Advanced tab, under the Technical section, called Use Shortcode? Shortcode OptionsĪs you can see from the image above the shortcode is very easy to turn on and with if you get a few extra options for changing particular information on the fly – a small table of these is shown below: OptionĬhange the theme location menu that is displayed. Menu language switcher on the front-end Global Settings You can set global settings for all language switchers on your site, such as the order of languages. The first thing you need to do is enable the shortcode option itself as without it the shortcode will not be active and you will just see text displayed on your site when trying to use it. ![]() This can all be achieved by using the built in shortcode and as with everything else with the plugin it is very easy to use. Using the technique above you can also use different menus for different languages all using the same plugin with the same settings. Sometimes however you may want a bit more control over the menu, like setting different options based on certain conditions – including different menus on different pages or for placing it inside a specific DOM element. The menu will work straight out of the box as soon as it has been activated as long as the wp_head() and wp_footer() calls are found in your header.php and footer.php files respectively.
0 Comments
Leave a Reply. |