Insights into WordPress Multi-Site, Domain Mapped, and Multilanguage site using WPML [closed]
Insights into WordPress Multi-Site, Domain Mapped, and Multilanguage site using WPML [closed]
Insights into WordPress Multi-Site, Domain Mapped, and Multilanguage site using WPML [closed]
You don’t have to make anything special for WPML, using the regular translation code should be enough. See I18n for WordPress Developers in the Codex. Code preparation style.css Add Text Domain and Domain Path to your theme’s style.css. Example: /* * Theme Name: My awesome theme * Text Domain: my_awesome_theme * Domain Path: /languages */ … Read more
Why do you dont use the default functions from WP. As example the follow class, there you can use. class fb_pagination_example { public function content_nav( $nav_id, $pag_bar = TRUE ) { if ( $GLOBALS[‘wp_query’] -> max_num_pages > 1 ) : ?> <nav id=”<?php echo $nav_id; ?>”> <h1 class=”assistive-text”><?php _e( ‘Post navigation’, WP_BASIS_TXTD ); ?></h1> <?php … Read more
Ok so the way I was able to just show English properties on the user admin page was with this posts_request hook: add_filter(‘posts_request’, function($sql, $query) { $is_user_edit_page = ( isset($_SERVER[‘HTTP_REFERER’]) && strpos($_SERVER[‘HTTP_REFERER’], ‘user-edit’) !== false ); $is_property_sql = (strpos($sql, ‘property’) !== false); if ($is_user_edit_page && $is_property_sql) { $sql = str_replace(“‘sp'”, “‘en'”, $sql); } return $sql; … Read more
You can accomplish different sidebar content per language with either the plugin Widget Logic, or with the Dynamic Widgets plugin Alternatively you can make different sidebar templates per language and use a conditional on the language: if(ICL_LANGUAGE_CODE==’en’){ get_sidebar(‘en’); } if(ICL_LANGUAGE_CODE==’fr’){ get_sidebar(‘fr’); }
I found that it required removing 4 filters/actions to undo WPML’s home_url modification. Since I didn’t know what else this might break, I ended up changing my site’s logo to use site_url() which in my case was the same, but not changed by WPML. function disable_things(){ remove_filter( ‘page_link’, array( $this, ‘permalink_filter’ ), 1, 2 ); … Read more
Try to check on DB level. This SQL should give a list of all spam comments (which I assume skräpposter means): SELECT * FROM `wp_comments` WHERE `comment_approved` = ‘spam’; If the SQL gives 0 lines, the issue is with WordPress counting those comments, but in fact there are none. If the SQL gives a list, … Read more
WPML defines constants that you can use go get the current language: ICL_LANGUAGE_CODE – current language code (eg: en,fr,sp). ICL_LANGUAGE_NAME_EN – Name of the current language in English (eg: English, French. Spanish). ICL_LANGUAGE_NAME – Name of current language, in the current language (eg: English, Français, Español).
Actually WordPress lacks a real function to get posts by slug/post-name. But you can use get_page_by_path() for it so you don’t have to use a custom query: if(function_exists(‘icl_object_id’)) { $post = get_page_by_path(‘your-slug’); $id = icl_object_id($post->ID,’post’,true); $link = get_permalink($id); } The only difference here is that you must use the full path i.e. (‘parent-page/sub-page’) if you … Read more
I’m working on a similar solution right now – the website must have language codes in all URLs (except the default language), but only pages are translatable in a way WPML/Polylang plugins do it. For news (blog) we just show posts in particular language (they are separate, not translations of each other). All the other … Read more