Chuyển đến nội dung Chuyển đến thanh bên

Waiting for author

Topic Tags: Compatibility

Overview of the issue

When using Virtue theme with WPML, the translated single portfolio displays a 404 page instead of the expected content, even after translating the slug in String Translation.

Workaround

Be sure to make a full backup of your site before proceeding.

  1. Open your theme’s functions.php file
  2. Add this snippet:
    add_filter( 'register_post_type_args', 'virtue_portfolio_args', 10, 2 );
     
    function virtue_portfolio_args( $args, $post_type ){
         
        if ( $post_type !== 'portfolio' ) {
            return $args;
        }
         
        $virtue_premium = virtue_premium_get_options();
        if ( ! empty( $virtue_premium['portfolio_permalink'] ) ) {
            $port_rewrite = $virtue_premium['portfolio_permalink'];
        } else {
            $port_rewrite = 'portfolio';
        }
         
        $args['has_archive'] = true;
        $args['rewrite'] = array('slug' => $port_rewrite);
         
        return $args;
    }
    
  3. Go to Theme OptionsPortfolio OptionsPortfolio Permalink Base and set a custom post type slug.
  4. Go to WPMLString Translation, search for the slug and translate it. It should be under the [virtue_premium]portfolio_permalink string name.
  5. Go to WPMLSettingsPost Type Translation and translate the portfolio post type slug with the exact translation that you added for the [virtue_premium]portfolio_permalink string.
  6. Go to SettingsPermalinks and save.

Để lại trả lời

Vui lòng giữ đúng chủ đề và tôn trọng người khác. Nếu bạn cần trợ giúp với các vấn đề không liên quan đến bài đăng này, hãy sử dụng Diễn đàn Hỗ trợ của chúng tôi để bắt đầu trò chuyện hoặc gửi vé hỗ trợ.

Bạn có thể sử dụng các thẻ này:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>