Support » Plugin: Sticky Custom Post Types » [Plugin: Sticky Custom Post Types] sticky post not work with wpml plugin

Viewing 2 replies - 1 through 2 (of 2 total)
  • HI eliawk,

    Have you fix this? I have the same problem.

    m4olivei

    (@m4olivei)

    Hey,

    Found the same issue. The problem is that WPML filters the sticky_posts option (in wp_options table), which is where the sticky data lives in the database. WPML joins on their own icl_translations table to translate the sticky data, which is good, only it hardcodes a check that the post is of type post. Thus WPML won’t allow custom posts types to be sticky. To fix this, you need to patch WPML. Open plugins/sitepress-multilingual-cms/sitepress.class.php

    I’m using version 2.8.1 and so the line I needed to alter was 6320. It’s the option_sticky_posts function and we need to edit the query line to the following:

    $posts = $wpdb->get_col("SELECT element_id FROM {$wpdb->prefix}icl_translations WHERE element_id IN (".join(',',$posts).") AND element_type LIKE 'post_%' AND language_code = '{$this->this_lang}'");

    eliawk, where is the thread on the WPML forum about this that you allude to? I’d like to submit a patch to them.

    Thanks,
    Matt

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Sticky Custom Post Types] sticky post not work with wpml plugin’ is closed to new replies.