Fail to get the total number of posts
This is basic PHP string concatenation echo ‘Total posts: ‘; $published_posts; Should be echo ‘Total posts: ‘ . $published_posts;
This is basic PHP string concatenation echo ‘Total posts: ‘; $published_posts; Should be echo ‘Total posts: ‘ . $published_posts;
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);
It’s likely going to be in your themes single.php file. Perhaps check for a function call to get the number of views, and comment out the code.
This is more of a MySQL question, but I think your design is fine and is unlikely to create any database problems, even for a lot of rows (up to 1,000,000). The reason for this is: Why this is fine Nearly everything you do with this table should be writes, and there will only be … Read more
have played around with the google analytics dashboard plugin, but there doesn’t seem to be any way to achieve what I am after There isn’t, because to use that plugin in the manner you want, you need a different GA account for each author to track each author, and select that account in the plugin … Read more
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
The easiest way might be to hide it using CSS. If there’s a class or id unique to the container, add this to your theme’s functions.php: add_action(‘admin_head’, ‘custom_admin_css_ha’); function custom_admin_css_ha() { echo ‘<style> #unique-id-or.unique-class-goes-here { display: none; } </style>’; }
Gathering page view statistics is inherently write operation, which is inherently heavy on resources. There are no appropriate mechanisms in WP for high volume writes at low resource consumption. Your best bet is using external analytics system/service and retrieving page view data from it.
Unless you have a “religious” objection to share data with google then using GA is just the simplest and best way to go. Storing stats in your DB is a good start if you want to bring your server down when there is slightly high traffic, and in any case you can get all the … Read more
Here’s an idea for a starting point, by looking how the word counting is done in the /wp-admin/js/post.js file: /** * Testing word price calculations */ add_action( ‘after_wp_tiny_mce’, function() { ?><script> ( function( $ ) { $( function() { // Init var $content = $( ‘#content’ ), $count = $( ‘#wp-word-count’ ).find( ‘.word-count’ ), total_price … Read more