Statify Frontend Counter
-
Hallo,
ich möchte gern auf meiner Seite (s. o.) einen Counter sichtbar haben, der die Besucher, die Statify im Backend zählt, live im Frontend anzeigt. Ich habe jetzt zwar über ein Snippet das Ganze irgendwie zum Laufen gebracht, bin mir aber nicht sicher, ob das dauerhaft zuverlässig funktioniert. Gibt es da eine elegantere Lösung mit dem Statify Plugin. Hier mals da aktuelle Snippet:
// Statify Besucher als Live-Shortcode anzeigen
function statify_besucher_live_shortcode() {
global $wpdb;// Tabelle, in der Statify die Besucher speichert $table_name = $wpdb->prefix . 'statify'; // Zähle alle Besucher seit dem 29.05.2025 $total = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $table_name WHERE created >= %s", '2025-05-29 00:00:00' ) ); if (!$total) { return 'Keine Besucherzahlen gefunden.'; } return "Besucher seit dem 29.05.2025: " . esc_html($total);}
add_shortcode(‘statify_besucher_live’, ‘statify_besucher_live_shortcode’);The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Statify Frontend Counter’ is closed to new replies.