WPML Plugin Not displaying multilingual Menus

I ended up having to manually detect the language, here’s how I solved it: <?php if (ICL_LANGUAGE_CODE == ‘fr’) { // display the menu en francais wp_nav_menu( array( ‘menu’ => ‘Navigation principale’, ‘theme_location’ => ‘primary’, ‘container_class’ => ‘menu-header’, ‘menu_id’ => ‘menu-primary-navigation’ ) ); } else { // show them the menu in English wp_nav_menu( array( … Read more

Changing settings of WooCommerce

You have two options: Contact Woo You can ensure your changes will be permanent by contacting WooThemes (the authors of the plugin) directly and asking them to add your country’s currency to the list. Use a filter Alternatively, remember that everything is filtered. Woo is using the woocommerce_currency_symbol filter in woocommerce.php. To add currencies to … Read more

How do I add a promotional message to my posts?

You’ll want to hook into the_content to add a message. Something like this: <?php add_filter(‘the_content’, ‘wpse51338_filter_content’); /* * Filter the content to add a message before and after it. */ function wpse51338_filter_content($content) { // not a singular post? just return the content if(!is_singular()) return $content; $msg = sprintf( ‘<p class=”special-message”>%s</p>’, __(‘Here is an awesome message!’, … Read more

List top 5 authors with most posts

Are you using WordPress 3.1+? There’s a nice get_users() function that’ll do the trick! However, you will need a little magic to boot: add_action( ‘pre_user_query’, ‘wpse_11832_pre_user_query’ ); /** * Adds “post_count” to the SELECT clause. Without this, the “post_count” * property for users will be undefined. * * @param object $wp_user_query */ function wpse_11832_pre_user_query( $wp_user_query … Read more

How do I redirect a post url to a custom url?

Well, actually WordPress provides wp redirect function. And here is a small plugin I’ve used a while back <?php $redirect_meta_key = ‘redirect_to’; add_action(‘template_redirect’, ‘redirect_this’); function redirect_this($nothing) { global $wp_query, $redirect_meta_key; if(is_single() || is_page()) { $redirect = get_post_meta($wp_query->post->ID, $redirect_meta_key, true); if(” != $redirect) { wp_redirect($redirect); header(“Status: 302”); exit; } } } ?> No all you have … Read more