WordPress.org

Ready to get started?Download WordPress

Forums

Sticky Custom Post Types
sticky post not work with wpml plugin (3 posts)

  1. eliawk
    Member
    Posted 1 year ago #

    if i disable WPML i can check the sticky post options – when i enable your plugin all post became unchecked.

    the wpml team tell me to ask the developer of the plugin to go here
    http://wpml.org/documentation/theme-compatibility/go-global-program/

    thanks!

    http://wordpress.org/extend/plugins/sticky-custom-post-types/

  2. lonchbox
    Member
    Posted 1 year ago #

    HI eliawk,

    Have you fix this? I have the same problem.

  3. m4olivei
    Member
    Posted 9 months ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.