prefix . 'adventi_leads'; /** * Total leads */ $query_total = " SELECT * FROM `{$wpdb->prefix}adventi_leads` ORDER BY id DESC "; // Plugin checker does NOT allow: $wpdb->get_results($query_total); $leads = $wpdb->get_results( " SELECT * FROM `{$wpdb->prefix}adventi_leads` ORDER BY id DESC " ); $total = is_array($leads) ? count($leads) : 0; /** * Today's leads count * prepare() IS needed because we pass a placeholder */ $query_today = $wpdb->prepare( " SELECT COUNT(*) FROM `{$wpdb->prefix}adventi_leads` WHERE DATE(date) = %s ", current_time('Y-m-d') ); $today = (int) $wpdb->get_var( $wpdb->prepare( " SELECT COUNT(*) FROM `{$wpdb->prefix}adventi_leads` WHERE DATE(date) = %s ", current_time('Y-m-d') ) ); /** * Load dashboard view template. * (Make sure the view outputs its own markup without requiring extra here.) */ $view_path = ADVENTI_PLUGIN_DIR . 'admin/views/adventi-dashboard-view.php'; if (file_exists($view_path)) { // Vars available to the view: // $total, $today, $leads. include $view_path; } /** * Extra text: no inline styles, no hardcoded text. */ echo '
' . sprintf( wp_kses( /* translators: %s is link to leads page */ __('👉 Go to %s to see full data.', 'adventi'), array( 'a' => array( 'href' => array(), ), 'span' => array(), ) ), '' . esc_html__('Leads', 'adventi') . '' ) . '
'; }