get( 'orderby' ) ) { return; } $query->set( 'meta_key', 'ss_total_share_count' ); $query->set( 'orderby', 'meta_value_num' ); } /** * Add custom fields to quick edit screen. * * @param string $column_name Custom column name, used to check * @param string $post_type * * @return void */ public function quick_edit_add( $column_name, $post_type ) { if ( 'ss_social_shares' !== $column_name ) { return; } echo '
'; } /** * Save custom fields to quick edit screen. * * @param int $post_id Post ID. * @return void */ public function quick_edit_save( $post_id ) { // phpcs:disable WordPress.Security.NonceVerification if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return $post_id; } if ( ! current_user_can( 'edit_post', $post_id ) ) { return $post_id; } if ( isset( $_POST['_inline_edit'], $_POST['post_view'] ) ) { $data = empty( $_POST['ss_social_share_disable'] ) ? 0 : 1; update_post_meta( $post_id, 'ss_social_share_disable', $data ); } } /** * Write javascript function to set checked to headline news checkbox * * @return void */ public function quick_edit_javascript() { ?> ID, 'ss_social_share_disable', true ); $data = empty( $data ) ? 0 : 1; $actions['inline hide-if-no-js'] = '"; $actions['inline hide-if-no-js'] .= 'Quick Edit'; $actions['inline hide-if-no-js'] .= ''; return $actions; } } new SocialSnap_Post_List_Table();