how to localize the number of wordpress post views?

The problem is most probably, that you don’t actually call the filter. WordPress does this not automatically for you. If you want to create a custom filter you have to manually call apply_filters, so that the added filters get executed: function the_views($postID){ $count_key = ‘views’; $count = get_post_meta($postID, $count_key, true); if($count==”){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, … Read more

To remove rendering of menus and header, plugin or theme?

Creating a Page Template is a much simpler way of alternating Page views, creating one is nice and easy: Simply copy the page.php in your theme, and paste it. Rename the file to anything, best practice is: page-template-something.php Put the following code into the file at the very top:   <?php /** * Template Name: … Read more

To remove rendering of menus and header, plugin or theme?

Creating a Page Template is a much simpler way of alternating Page views, creating one is nice and easy: Simply copy the page.php in your theme, and paste it. Rename the file to anything, best practice is: page-template-something.php Put the following code into the file at the very top:   <?php /** * Template Name: … Read more

How to display total views of all posts of one category?

<?php $QUERY = new Wp_query(array( ‘post_type’ => ‘post_type_here’, ‘category_name’ => ‘category_name_here’, // you can use cat id … )); $counter = 0; while( $QUERY->have_posts() ) : $QUERY->the_post(); $views = absint( getPostViews( $post->ID ) ); $counter += $views; endwhile; wp_reset_postdata(); echo $counter; ?> getPostViews() and setPostViews : function getPostViews( $postID ){ $count_key = ‘post_views_count’; $count = … Read more