Resources
Most popular categories
Other categories
Latest Posts
-
How to create a custom language switcher in MultilingualPress
In this tutorial we will create a custom language switcher using the MultilingualPress API. We will start creating a simple language menu and then convert it to a select dropdown. Finally we will explain how to add the language switcher to a WordPress widget. Get translations for the current page In order to create a…
-
How to copy post meta to the remote sites
This code snippet shows how to copy post meta to the remote site(s). In the example it gets the value of yoast_wpseo_title post meta from the request and then updates the value in the connected sites. add_action('multilingualpress.metabox_after_relate_posts', function($context, $request) { // get post meta value from source site $yoastWpseoTitleValue = (string)$request->bodyValue( 'yoast_wpseo_title', INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS );…
-
How to programmatically connect content
If you want to connect content programmatically across sites you need to know the IDs of the posts you want to connect beforehand. So let say that we have 3 sites with site ids 1, 2 and 3 and we want to connect a post with the following post ids on each site: post id…
-
How to get connected post IDs by current post ID
To get an array of connected posts you can use the translationIds function. That method is the equivalent of mlp_get_linked_elements in MultilingualPress 2: The first parameter is the source post id, the second is the column “type” in the wp_mlp_relationships table in the database and the third parameter is the source site id. About the type…
-
How to get content translations programmatically
In order to get current content translations of the current post in MultilingualPress, you can use the Translations class passing the arguments via TranslationSearchArgs. Here is an example: add_filter('the_content', function($content) { $args = \Inpsyde\MultilingualPress\Framework\Api\TranslationSearchArgs::forContext( new \Inpsyde\MultilingualPress\Framework\WordpressContext() )->forSiteId(get_current_blog_id())->includeBase(); $translations = \Inpsyde\MultilingualPress\resolve( \Inpsyde\MultilingualPress\Framework\Api\Translations::class )->searchTranslations($args); foreach ($translations as $translation) { $postId = $translation->remoteContentId(); $title = $translation->remoteTitle(); $url =…
-
MultilingualPress-Yoast-SEO-Sync
What is MultilingualPress-Yoast-Seo-Sync for? MultilingualPress-Yoast-Seo-Sync helps you to manage the metadata of the Yoast SEO plugin for translated posts or sites in your MultilingualPress network. The addon provides additional Yoast tabs for every translation in the editor and enables you to set up the data in one place. No more switching between different translations of…
-
How to translate custom post types and taxonomies
In this document we explain you how to translate custom post types and taxonomies in MultilingualPress. To demonstrate it, we’ll create a WordPress Multisite installation with two connected sites. We are going to use the Custom Post Type UI plugin to create a custom post type and a taxonomy. Just keep in mind that the process…
-
MultilingualPress and WordPress 5.0 (Gutenberg)
We are almost there: on 27th of November WordPress will change its editor and it will not be a small change. In fact the new WordPress 5.0 will include Gutenberg in the core. If you are wondering what Gutenberg is, the answer is: a completely new way of writing and processing content in WordPress. The Gutenberg…
-
MultilingualPress 3 (and higher) – Common Questions & Answers
What is the difference between MultilingualPress 3+ & 2? MultilingualPress 3+ is the complete refactoring of version 2. Version 3 (and higher) is only available as a premium plugin and is based on PHP 7. So, it is a state-of-the-art code compatible with the coming Gutenberg editor. For more information check out our documentation What’s…
-
WordPress multisite compatible plugins – the definitive list
Are you currently building a WordPress multisite network? Do you already have one and are looking for plugins to equip your network with additional features? Then it’s inevitable that you will deal with the question of WordPress multisite compatible plugins. That’s because you cannot use all plugins within a multisite. Now we will explain how…
