22/**
33 * Plugin Name: CBX Search Tracker
44 * Description: Tracks WordPress search keywords and shows most searched keywords in admin dashboard.
5- * Version: 1.2.0
5+ * Version: 1.2.1
66 * Author: Codeboxr
77 * Text Domain: cbxsearchtracker
88 * Domain Path: /languages
@@ -151,6 +151,15 @@ public function admin_page() {
151151 "SELECT * FROM {$ this ->table_name } ORDER BY search_count DESC LIMIT 100 "
152152 );
153153
154+ $ total_keywords = (int ) $ wpdb ->get_var (
155+ "SELECT COUNT(*) FROM {$ this ->table_name }"
156+ );
157+
158+ $ total_searches = (int ) $ wpdb ->get_var (
159+ "SELECT SUM(search_count) FROM {$ this ->table_name }"
160+ );
161+
162+
154163 echo '<div class="wrap"> ' ;
155164 echo '<h1> ' . esc_html__ ( 'Most Searched Keywords ' , 'cbxsearchtracker ' ) . '</h1> ' ;
156165
@@ -167,13 +176,25 @@ public function admin_page() {
167176 }
168177
169178
170- // Delete All Button
171- echo '<form method="post" style="margin-bottom:15px;"> ' ;
179+ echo '<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:15px;"> ' ;
180+
181+ // LEFT SIDE — Delete All Button
182+ echo '<form method="post"> ' ;
172183 wp_nonce_field ('cbx_delete_all_keywords ' );
173184 echo '<input type="hidden" name="cbx_delete_all" value="1" /> ' ;
174185 echo '<input type="submit" class="button button-primary" value=" ' . esc_attr__ ('Delete All Keywords ' , 'cbxsearchtracker ' ) . '" onclick="return confirm( \'Are you sure you want to delete all keywords? \');" /> ' ;
175186 echo '</form> ' ;
176187
188+ // RIGHT SIDE — Total Stats
189+ echo '<div style="font-weight:600;"> ' ;
190+ echo esc_html__ ('Total Keywords: ' , 'cbxsearchtracker ' ) . ' ' . esc_html ($ total_keywords );
191+ echo ' | ' ;
192+ echo esc_html__ ('Total Searches: ' , 'cbxsearchtracker ' ) . ' ' . esc_html ($ total_searches );
193+ echo '</div> ' ;
194+
195+ echo '</div> ' ;
196+
197+
177198
178199 echo '<table class="widefat striped"> ' ;
179200 echo '<thead><tr> ' ;
0 commit comments