Multilingualpress & Posts 2 Posts Plugin
-
Hey,
I’m using the multilingualpress Plugin. Our Website is a little bit complex, we have different Post-Types and these Post-Types got different connections among each others. For connect the different Post-Types we use the Posts 2 Posts.
Both Plugins work really well.
But now I have a little porblem an d I hope someone can help me.
When I translate the german Post to the English, I want to get the setted connections in the english post too.
Can I add the connections in the Mlp_Translatable_Post_Data.php? Is it possible, that it works like this? Where I have to implement the Connections in the MultilingualPress?public function save($post_id, WP_Post $post) { if ( ! $this->is_valid_save_request( $post ) ) { return; } $post_id = $this->get_real_post_id( $post_id ); $this->save_context = array( 'source_blog' => get_current_blog_id(), 'source_post' => $post, 'real_post_type' => $this->get_real_post_type( $post ), 'real_post_id' => $post_id, ); // Get the post $post_data = get_post( $post_id, ARRAY_A ); $post_meta = $this->get_post_meta_to_transfer(); // Get the post connections $post_connection = p2p_get_meta( $post_id, 'type', true); /** This filter is documented in inc/advanced-translator/Mlp_Advanced_Translator_Data.php */ $post_data = apply_filters( 'mlp_pre_save_post', $post_data, $this->save_context ); if ( ! $post_data || ! is_array( $post_data ) ) { return; } $file = $path = ''; $fileinfo = array(); // Check for thumbnail if ( current_theme_supports( 'post-thumbnails' ) ) { $thumb_id = get_post_thumbnail_id( $post_id ); if ( 0 < $thumb_id ) { $path = wp_upload_dir(); $file = get_post_meta( $thumb_id, '_wp_attached_file', true ); $fileinfo = pathinfo( $file ); include_once( ABSPATH . 'wp-admin/includes/image.php' ); //including the attachment function } } // Create the post array $new_post = array( 'post_title' => $post_data['post_title'], 'post_content' => $post_data['post_content'], 'post_status' => 'publish', 'post_author' => $post_data['post_author'], 'post_excerpt' => $post_data['post_excerpt'], 'post_date' => $post_data['post_date'], 'post_type' => $post_data['post_type'], 'connected_type' => $post_connection ['connected_type'], 'connected_items' => $post_connection ['connected_items'], // Create the connection part of the array // 'p2p_id' => $post_connection['post_connection'], );
I hope someone can help me!
Thanks in advance!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Multilingualpress & Posts 2 Posts Plugin’ is closed to new replies.