You can make a list from Page Stats, including ID, Count, and Page Slug, by the following code:
<?php
global $wpdb, $table_prefix;
$page_slug = '%about%';
$pages = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `{$table_prefix}statistics_pages` WHERE `uri` LIKE %s", $page_slug ) );
echo '<table border="1"><tr><td>ID</td><td>Count</td><td>Slug</td></tr>';
foreach ( $pages as $page ) {
echo "<tr><td>{$page->id}</td><td>{$page->count}</td><td>{$page->uri}</td></tr>";
}
echo '</table>';
Comments
Larry Reeder
I tried putting that code in the “Notification” “Message body” field.
//////////////////////////////////////////////////////////
This is what I have in the Message body:
//////////////////////////////////////////////////////////
This was automatically created and sent.
Page views for “In the News”: [wpstatistics stat=page time=week id=in-the-news]
Page views for “Home”: [wpstatistics stat=page time=week id=home]
Yesterday’s Visitors: [wpstatistics stat=visitors time=yesterday]
Yesterday’s Visits: [wpstatistics stat=visits time=yesterday]
Last Week’s Visitors: [wpstatistics stat=visitors time=week]
Last Week’s Visits: [wpstatistics stat=visits time=week]
Total Visitors:Â [wpstatistics stat=visitors time=total]
Total Visits:Â [wpstatistics stat=visits time=total]
get_results( $wpdb->prepare( "SELECT * FROM `{$table_prefix}statistics_pages` WHERE `uri` LIKE %s", $page_slug ) );
echo 'IDCountSlug';
foreach ( $pages as $page ) {
echo "{$page->id}{$page->count}{$page->uri}";
}
echo '';
?>
//////////////////////////////////////////////////////////
I get the following in the email.
//////////////////////////////////////////////////////////
get_results( $wpdb->prepare( “SELECT * FROM `{$table_prefix}statistics_pages` WHERE `uri` LIKE %s”, $page_slug ) ); echo ‘
ID Count Slug
‘; foreach ( $pages as $page ) { echo ”
{$page->id} {$page->count} {$page->uri}
“; } echo ‘ {{{there’s a message up table here }}} which also has some of the PHP in it.
‘; ?>
Mostafa Soufi
Hi, thank you for commenting, please keep in mind, this code should be added in your theme directory, not in the setting page.
Comments are closed.