Forum Replies Created

Viewing 1 replies (of 1 total)
  • klas_e

    (@klas_e)

    A quick fix is to open post-types-order.php ange change the CTPOrderPosts function on line 85:

    if ($options['adminsort'] == "1")

    to

    if ($options['adminsort'] == "1" && $query->query_vars['post_type'] !== 'attachment')

    Full function after change:

    function CPTOrderPosts($orderBy, $query)
        {
            global $wpdb;
    
            $options = get_option('cpto_options');
    
            //ignore the bbpress
            if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("reply", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "reply")))
                return $orderBy;
            if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("topic", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "topic")))
                return $orderBy;
            error_log(($query->query_vars['post_type']), 0);
            if (is_admin())
                    {
                        if ($options['adminsort'] == "1" && $query->query_vars['post_type'] !== 'attachment')
                            $orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
                    }
                else
                    {
                        if ($options['autosort'] == "1")
                            $orderBy = "{$wpdb->posts}.menu_order, " . $orderBy;
                    }
    
                    //);
            return($orderBy);
        }
Viewing 1 replies (of 1 total)