Count views for single posts and pages
This commit is contained in:
@@ -4,6 +4,7 @@ function sportspress_manage_posts_columns( $defaults ){
|
||||
return $defaults;
|
||||
}
|
||||
add_filter( 'manage_posts_columns', 'sportspress_manage_posts_columns' );
|
||||
add_filter( 'manage_page_posts_columns', 'sportspress_manage_posts_columns' );
|
||||
|
||||
function sportspress_manage_posts_custom_column( $column, $post_id ) {
|
||||
global $post;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
function sportspress_the_content( $content ) {
|
||||
sportspress_set_post_views( get_the_ID() );
|
||||
if ( is_single() || is_page() )
|
||||
sportspress_set_post_views( get_the_ID() );
|
||||
return $content;
|
||||
}
|
||||
add_filter( 'the_content', 'sportspress_the_content' );
|
||||
|
||||
Reference in New Issue
Block a user