تخطي إلى المحتوى تخطي إلى الشريط الجانبي

Open

Topic Tags: Compatibility

Overview of the issue

In some cases, Oxygen Builder templates translations are not displayed correctly for logged-out visitors.

Workaround

Please, make sure of having a full backup of your site before proceeding and keep in mind that Oxygen is not currently compatible with WPML.

  • Install a plugin like WP Code and make sure the snippet is read as a PHP code.
  • Add the following snippet:
    add_action( 'init', 'wpml_ct_add_templates_cpt' );
    
    function wpml_ct_add_templates_cpt() {
    
    	$labels = array(
    		'name'               => _x( 'Templates', 'post type general name', 'component-theme' ),
    		'singular_name'      => _x( 'Template', 'post type singular name', 'component-theme' ),
    		'menu_name'          => _x( 'Templates', 'admin menu', 'component-theme' ),
    		'name_admin_bar'     => _x( 'Template', 'add new on admin bar', 'component-theme' ),
    		'add_new'            => _x( 'Add New Template', 'template', 'component-theme' ),
    		'add_new_item'       => __( 'Add New Template', 'component-theme' ),
    		'new_item'           => __( 'New Template', 'component-theme' ),
    		'edit_item'          => __( 'Edit Template', 'component-theme' ),
    		'view_item'          => __( 'View Template', 'component-theme' ),
    		'all_items'          => __( 'Templates', 'component-theme' ),
    		'search_items'       => __( 'Search Templates', 'component-theme' ),
    		'parent_item_colon'  => __( 'Parent Templates:', 'component-theme' ),
    		'not_found'          => __( 'No templates found.', 'component-theme' ),
    		'not_found_in_trash' => __( 'No templates found in Trash.', 'component-theme' )
    	);
    
    	$args = array(
    		'exclude_from_search' => true,
    		'labels'             => $labels,
    		'public'             => true,
    		'publicly_queryable' => true,
    		'has_archive'		 => true,
    		'show_ui'            => true,
    		'show_in_menu'       => 'ct_template',
    		'rewrite' 			 => false,
    		'query_var'          => true,
    		'capability_type'    => 'post',
    		'hierarchical'       => false,
    		'menu_position'      => null,
    		'supports'           => array( 'title' )
    	);
    
    	register_post_type( 'ct_template', $args );
    
    }
    
  • Translate your Oxygen templates using WordPress Editor.

رد واحد إلى “Oxygen - Templates Translation Issues for Logged-Out Visitors”

  1. Oxygen and WPML work fine together. I’ve developed many complex Oxygen-based sites that use WPML with zero problems.

    All you need to do is treat your Oxygen site as if it’s a standard WordPress theme, by which I mean:

    Don’t try to translate Oxygen templates or any elements contained in Oxygen templates directly. Instead, translate the strings those templates include by wrapping those strings in a text domain (inside a code block) and scanning / registering them with the String Translation module of WPML.

اترك ردًا

الرجاء البقاء في الموضوع واحترام الآخرين. إذا كنت بحاجة إلى مساعدة في مشكلات غير متعلقة بهذا المنشور، استخدم منتدى الدعم الخاص بنا لبدء محادثة أو تقديم تذكرة.

يمكنك استخدام هذه الوسوم:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>