A better way to get stats

You’ve got one very large issue here – you’re using $_SESSION. WordPress, by default, doesn’t use session variables. So isset( $_SESSION[‘vsp_user’] ) will always return false because WP isn’t keeping track of things. There are some additional changes you’ll need to make and hooks you’ll need to tie in to in order to enable sessions … Read more

See some statistics about the comments

For most commented posts you can use a custom loop in the sidebar for example: <h3>Most Commented Posts</h3> <?php $most_commented = new WP_Query(‘orderby=comment_count&posts_per_page=5’); if($most_commented->have_posts()) : ?> <ul class=”most-commented-posts”> <?php while($most_commented->have_posts()) : $most_commented->the_post(); ?> <li><a href=”https://wordpress.stackexchange.com/questions/38006/<?php the_permalink() ?>” rel=”bookmark” title=”<?php the_title_attribute(); ?>”><?php the_title(); ?> (<?php comments_number(‘0′,’1′,’%’); ?>)</a></li> <?php endwhile; ?> </ul><!– most-commented-posts –> <?php endif; wp_reset_query(); … Read more

Need to know custom code to display random and most viewed posts in wordpress posts and pages

A standard WordPress install doesn’t keep track of visits to pages/posts. So without a plugin there’s no way to know which posts/pages are visited most often. As to finding random posts that’s as simple as: $args = array( ‘post_type’ => array( ‘post’, ‘page’, ‘my-custom-post-type’ ) ‘orderby’ => ‘rand’, ); $query = new WP_Query ($args);

WordPress stats: OWA plugin overhead in the future

I hadn’t used this specific solution, but any self-hosted analytics in general should be considered potentially huge resource hog: every async action in WordPress is effectively another WP core load, so if tracking code makes even one additional async request to back-end it effectively doubles the load; stat logging by nature cannot be cached; stat … Read more