WordPress.org

Ready to get started?Download WordPress

Forums

qTranslate
Bug: Custom post type without title breaks qTranslate (2 posts)

  1. normadize
    Member
    Posted 1 year ago #

    Hi,

    If you define a custom post type that does not have/support a title (and option in the native WP API) then the edit post screen is completely broken if qTranslate is active. It seems that qTranslate expects to see a title edit field and then most of the Javascript code then fails, breaking the TniyMCE editor tabs and area too.

    Anyone else stumbled upon this?

    Cheers, and keep up the good work.

    http://wordpress.org/extend/plugins/qtranslate/

  2. Ryan
    Member
    Posted 1 year ago #

    Came across this trying to work out the same issue. What I wound up doing is adding title back to the custom post type and then hiding everything with CSS. Not my favorite solution, but it appears to have worked.

    add_action('init', 'pb_qt_init', 100);
    function pb_qt_init() {
        add_post_type_support('my_custom_post_type', 'title');
    }
    
    add_action('admin_head-post.php', 'pb_qt_head_post');
    add_action('admin_head-post-new.php', 'pb_qt_head_post');
    function pb_qt_head_post() {
        global $post;
    
        if ('my_custom_post_type' == $post->post_type) {
            echo '
                <style type="text/css">
                *[class*=qtrans_], div#titlediv { display:none;}
                </style>
            ';
        }
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.