[ self::INCLUSIVE_LANGUAGE_COLUMN_NAME ] = \sprintf( '%2$s', \esc_attr__( 'Inclusive language score', 'wordpress-seo-premium' ), \esc_html__( 'Inclusive language score', 'wordpress-seo-premium' ) ); return $columns; } /** * Modifies the query pieces to allow ordering column by inclusive language score. * * @param array $pieces Array of Query pieces. * @param WP_Query $query The Query on which to apply. * * @return array */ public function order_by_inclusive_language_score( $pieces, $query ) { if ( $query->get( 'orderby' ) !== self::INCLUSIVE_LANGUAGE_COLUMN_NAME ) { return $pieces; } return $this->build_sort_query_pieces( $pieces, $query ); } /** * Builds the pieces for a sorting query. * * @param array $pieces Array of Query pieces. * @param WP_Query $query The Query on which to apply. * * @return array Modified Query pieces. */ protected function build_sort_query_pieces( $pieces, $query ) { // We only want our code to run in the main WP query. if ( ! $query->is_main_query() ) { return $pieces; } // Get the order query variable - ASC or DESC. $order = \strtoupper( $query->get( 'order' ) ); // Make sure the order setting qualifies. If not, set default as ASC. if ( ! \in_array( $order, [ 'ASC', 'DESC' ], true ) ) { $order = 'ASC'; } $table = Model::get_table_name( 'Indexable' ); $pieces['join'] .= " LEFT JOIN $table AS yoast_indexable ON yoast_indexable.object_id = {$this->wpdb->posts}.ID AND yoast_indexable.object_type = 'post' "; $pieces['orderby'] = "yoast_indexable.inclusive_language_score $order, {$pieces['orderby']}"; return $pieces; } /** * Displays the column content for the given column. * * @param string $column_name Column to display the content for. * @param int $post_id Post to display the column content for. * * @return void */ public function column_content( $column_name, $post_id ) { $indexable = $this->admin_columns_cache->get_indexable( $post_id ); // Nothing to output if we don't have the value. if ( empty( $indexable ) ) { return; } if ( $column_name === self::INCLUSIVE_LANGUAGE_COLUMN_NAME ) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Correctly escaped through the Score_Icon_Helper. echo $this->score_icon_helper->for_inclusive_language( $indexable->inclusive_language_score ); } } /** * Sets the sortable columns. * * @param array $columns Array with sortable columns. * * @return array The extended array with sortable columns. */ public function column_sort( $columns ) { $columns[ self::INCLUSIVE_LANGUAGE_COLUMN_NAME ] = self::INCLUSIVE_LANGUAGE_COLUMN_NAME; return $columns; } } Látványterv - SMG Tervezőiroda

Látványtervek