settings = new WPML_post_slug_translation_settings( $sitepress ); $this->post_sync_setting = new WPML_Custom_Post_Sync_Settings( $sitepress ); wp_enqueue_script( 'wpml-custom-post-ui', WPML_ST_URL . '/res/js/wpml_custom_post_ui.js', array( 'jquery' ), WPML_ST_VERSION, true ); } public function render( $post_type, $custom_post ) { $_has_slug = isset( $custom_post->rewrite['slug'] ) && $custom_post->rewrite['slug']; $_on = $this->settings->is_on() && $_has_slug && $this->post_sync_setting->is_sync( $post_type ); $is_hidden = $_on ? '' : 'hidden'; $_translate = $this->settings->is_translate( $post_type ); $string_id = null; if ( $_has_slug ) { list( $string_id, $_slug_translations ) = WPML_Slug_Translation::get_translations( $post_type ); if ( $this->settings->is_on() && $_translate && ! $string_id ) { $message = sprintf( esc_html__( '%s slugs are set to be translated, but they are missing their translation', 'wpml-string-translation' ), $custom_post->labels->name ); ICL_AdminNotifier::displayInstantMessage( $message, 'error', 'below-h2', false ); } } else { $_slug_translations = false; } if ( $_has_slug && $this->settings->is_on() ) { ?>
sitepress ); $lang_selector->render( array( 'name' => 'translate_slugs[' . $post_type . '][original]', 'selected' => $language['code'], 'show_please_select' => false, 'echo' => true, 'class' => 'js-translate-slug-original', 'data' => array( 'slug' => $post_type ), ) ); ?> |