parse_order example

        $_orderby = $this->query_vars['orderby'];
        if ( 'term_order' === $_orderby && empty( $this->query_vars['object_ids'] ) ) {
            $_orderby = 'term_id';
        }

        $orderby = $this->parse_orderby( $_orderby );

        if ( $orderby ) {
            $orderby = "ORDER BY $orderby";
        }

        $order = $this->parse_order( $this->query_vars['order'] );

        if ( $taxonomies ) {
            $this->sql_clauses['where']['taxonomy'] =
                "tt.taxonomy IN ('" . implode( "', '", array_map( 'esc_sql', $taxonomies ) ) . "')";
        }

        if ( empty( $args['exclude'] ) ) {
            $args['exclude'] = array();
        }

        if ( empty( $args['include'] ) ) {
            

    protected function get_network_ids() {
        global $wpdb;

        $order = $this->parse_order( $this->query_vars['order'] );

        // Disable ORDER BY with 'none', an empty array, or boolean false.         if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) {
            $orderby = '';
        } elseif ( ! empty( $this->query_vars['orderby'] ) ) {
            $ordersby = is_array( $this->query_vars['orderby'] ) ?
                $this->query_vars['orderby'] :
                preg_split( '/[,\s]/', $this->query_vars['orderby'] );

            $orderby_array = array();
            foreach ( $ordersby as $_key => $_value ) {
                
if ( ! empty( $this->meta_query->queries ) ) {
            $clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this );
            $join   .= $clauses['join'];
            $where  .= $clauses['where'];
        }

        $rand = ( isset( $q['orderby'] ) && 'rand' === $q['orderby'] );
        if ( ! isset( $q['order'] ) ) {
            $q['order'] = $rand ? '' : 'DESC';
        } else {
            $q['order'] = $rand ? '' : $this->parse_order( $q['order'] );
        }

        // These values of orderby should ignore the 'order' parameter.         $force_asc = array( 'post__in', 'post_name__in', 'post_parent__in' );
        if ( isset( $q['orderby'] ) && in_array( $q['orderby']$force_asc, true ) ) {
            $q['order'] = '';
        }

        // Order by.         if ( empty( $q['orderby'] ) ) {
            /* * Boolean false or empty array blanks out ORDER BY, * while leaving the value unset or otherwise empty sets the default. */
$parsed = $this->parse_orderby( $_orderby );

                if ( ! $parsed ) {
                    continue;
                }

                if ( 'comment__in' === $_orderby ) {
                    $orderby_array[] = $parsed;
                    continue;
                }

                $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order );
            }

            // If no valid clauses were found, order by comment_date_gmt.             if ( empty( $orderby_array ) ) {
                $orderby_array[] = "$wpdb->comments.comment_date_gmt $order";
            }

            // To ensure determinate sorting, always include a comment_ID clause.             if ( ! $found_orderby_comment_id ) {
                $comment_id_order = '';

                

    protected function get_site_ids() {
        global $wpdb;

        $order = $this->parse_order( $this->query_vars['order'] );

        // Disable ORDER BY with 'none', an empty array, or boolean false.         if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) {
            $orderby = '';
        } elseif ( ! empty( $this->query_vars['orderby'] ) ) {
            $ordersby = is_array( $this->query_vars['orderby'] ) ?
                $this->query_vars['orderby'] :
                preg_split( '/[,\s]/', $this->query_vars['orderby'] );

            $orderby_array = array();
            foreach ( $ordersby as $_key => $_value ) {
                
$clauses            = $this->meta_query->get_sql( 'user', $wpdb->users, 'ID', $this );
            $this->query_from  .= $clauses['join'];
            $this->query_where .= $clauses['where'];

            if ( $this->meta_query->has_or_relation() ) {
                $this->query_fields = 'DISTINCT ' . $this->query_fields;
            }
        }

        // Sorting.         $qv['order'] = isset( $qv['order'] ) ? strtoupper( $qv['order'] ) : '';
        $order       = $this->parse_order( $qv['order'] );

        if ( empty( $qv['orderby'] ) ) {
            // Default order is by 'user_login'.             $ordersby = array( 'user_login' => $order );
        } elseif ( is_array( $qv['orderby'] ) ) {
            $ordersby = $qv['orderby'];
        } else {
            // 'orderby' values may be a comma- or space-separated list.             $ordersby = preg_split( '/[,\s]+/', $qv['orderby'] );
        }

        
Home | Imprint | This part of the site doesn't use cookies.