【问题标题】:WPML translate option not showing for custom post types自定义帖子类型未显示 WPML 翻译选项
【发布时间】:2016-12-04 00:55:51
【问题描述】:

我在我的网站上配置了 wpml。对于默认帖子,它会显示翻译选项,如下图所示。

Bur 对于自定义帖子类型,它不显示翻译选项。

我在谷歌上找到了一些解决方案,帖子说 register_post_type 可能有一些问题。

我的代码:

// Register Custom Post Type
function werk_post_type() {

    $labels = array(
        'name'                  => _x( 'Post Types', 'Post Type General Name', 'twentysixteen' ),
        'singular_name'         => _x( 'werk', 'Post Type Singular Name', 'twentysixteen' ),
        'menu_name'             => __( 'Werk', 'twentysixteen' ),
        'name_admin_bar'        => __( 'Werk', 'twentysixteen' ),
        'archives'              => __( 'Item Archives', 'twentysixteen' ),
        'parent_item_colon'     => __( 'Parent Item:', 'twentysixteen' ),
        'all_items'             => __( 'All Items', 'twentysixteen' ),
        'add_new_item'          => __( 'Add New Item', 'twentysixteen' ),
        'add_new'               => __( 'Add New', 'twentysixteen' ),
        'new_item'              => __( 'New Item', 'twentysixteen' ),
        'edit_item'             => __( 'Edit Item', 'twentysixteen' ),
        'update_item'           => __( 'Update Item', 'twentysixteen' ),
        'view_item'             => __( 'View Item', 'twentysixteen' ),
        'search_items'          => __( 'Search Item', 'twentysixteen' ),
        'not_found'             => __( 'Not found', 'twentysixteen' ),
        'not_found_in_trash'    => __( 'Not found in Trash', 'twentysixteen' ),
        'featured_image'        => __( 'Featured Image', 'twentysixteen' ),
        'set_featured_image'    => __( 'Set featured image', 'twentysixteen' ),
        'remove_featured_image' => __( 'Remove featured image', 'twentysixteen' ),
        'use_featured_image'    => __( 'Use as featured image', 'twentysixteen' ),
        'insert_into_item'      => __( 'Insert into item', 'twentysixteen' ),
        'uploaded_to_this_item' => __( 'Uploaded to this item', 'twentysixteen' ),
        'items_list'            => __( 'Items list', 'twentysixteen' ),
        'items_list_navigation' => __( 'Items list navigation', 'twentysixteen' ),
        'filter_items_list'     => __( 'Filter items list', 'twentysixteen' ),
    );
    $args = array(
        'label'                 => __( 'werk', 'twentysixteen' ),
        'description'           => __( 'Post Type Description', 'twentysixteen' ),
        'labels'                => $labels,
        'supports'              => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', 'page-attributes', ),
        'taxonomies'            => array( 'category', 'post_tag' ),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => true,
        'menu_position'         => 5,
        'show_in_admin_bar'     => true,
        'show_in_nav_menus'     => true,
        'can_export'            => true,
        'has_archive'           => true,        
        'exclude_from_search'   => false,
        'publicly_queryable'    => true,
        'capability_type'       => 'page',
    );
    register_post_type( 'werk', $args );

}
add_action( 'init', 'werk_post_type', 0 );

有人可以通过指出这里可能出现的问题来帮助我。感谢您的宝贵时间。

【问题讨论】:

    标签: wordpress custom-post-type wpml


    【解决方案1】:

    在编辑您的工作帖子类型条目时,您应该在页面底部有一个名为多语言内容设置的框,其中包含一个复选框:使“工作”可翻译。选中该复选框并点击应用。然后,您应该能够为每个工作条目创建翻译。

    【讨论】:

    • 非常感谢。你刚刚拯救了我的一天。
    • 没问题。很高兴帮助:)
    猜你喜欢
    • 1970-01-01
    • 2017-11-08
    • 2023-03-22
    • 2021-08-21
    • 1970-01-01
    • 2014-03-05
    • 2022-07-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多