Skip Navigation

Resolved

Overview of the issue

This issue appears when you set the featured content layout to slider or grid (by navigating to Appearance > Customize > Featured Content) and give it the tag «home». When you create a post in the default language (add a featured image and the tag «home») and translate it. The post will appear twice on the secondary language posts page, once as a featured post and another as a regular post.

Workaround

This happened because the variable $post__not_in  includes the ids of the featured posts that comes from the default language not to be displayed as a regular post.  The default language post id is used to filter the secondary language featured post, which explains why the both posts appear.

To overcome this issue add the below code to the following directory ( wp-content/themes/twentyfourteen/inc/featured-content.php ) . Make sure to add it after line number 251, that includes ($post__not_in = $query->get( ‘post__not_in’ );)

$my_current_lang = apply_filters( 'wpml_current_language', NULL );
        $my_default_lang = apply_filters('wpml_default_language', NULL );
        if($my_current_lang != $my_default_lang) {

            for ($i = 0; $i < count($featured); $i++) {
                $featured[$i] = apply_filters('wpml_object_id', $featured[$i], 'post');
            }
        }

комментария 2 на “Twenty Fourteen featured post appears twice in the secondary language”