{"id":232985,"date":"2023-02-01T17:44:00","date_gmt":"2023-02-01T14:44:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=232985"},"modified":"2022-11-10T18:38:40","modified_gmt":"2022-11-10T15:38:40","slug":"come-visualizzare-le-statistiche-del-blog-a-pie-di-pagina","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/it\/come-visualizzare-le-statistiche-del-blog-a-pie-di-pagina\/","title":{"rendered":"Come visualizzare le statistiche del blog a pi\u00e8 di pagina?"},"content":{"rendered":"<p>Quasi tutti i temi wordpress hanno un file <strong>footer.php<\/strong> che contiene il layout per il footer della pagina. Puoi inserire il seguente codice PHP+MySQL per visualizzare alcune statistiche del blog alla fine di ogni pagina.<\/p>\n<pre><code>&lt;?php\nglobal $wpdb;\/\/ &lt;a class=\"vglnk\" target=\"_blank\" href=\"https:\/\/helloacm.com\" rel=\"nofollow\"&gt;&lt;span&gt;https&lt;\/span&gt;&lt;span&gt;:\/\/&lt;\/span&gt;&lt;span&gt;helloacm&lt;\/span&gt;&lt;span&gt;.&lt;\/span&gt;&lt;span&gt;com&lt;\/span&gt;&lt;\/a&gt;\n$query = \"select count(1) from `wp_posts` where `post_status`='publish' and `post_type`='post'\";\n$cnt_posts = $wpdb-&gt;get_var($query);\n$query = \"select count(1) from `wp_posts` where `post_status`='publish' and `post_type`='page'\";\n$cnt_pages = $wpdb-&gt;get_var($query);\n$query = \"select count(1) from `wp_comments` where `comment_approved`=1\";\n$cnt_comments = $wpdb-&gt;get_var($query);\n$start = strtotime(\"2011-07-03 00:00:00\"); \u00a0\/\/ Need to replace the date to the date when you published your first article.\n$today = strtotime(date(\"Y-m-d h:i:s\"));\n$days = round(abs($today - $start) \/ 3600 \/ 24);\n?&gt;\n\u00a0\nBlog is up for &lt;?php echo $days;?&gt; days, and there are &lt;?php echo $cnt_posts;?&gt; posts and &lt;?php echo $cnt_pages;?&gt; pages, there are &lt;?php echo $cnt_comments;?&gt; comments.<\/code><\/pre>\n<p>La data in cui hai pubblicato il tuo primo post \u00e8 memorizzata nella variabile PHP <strong>$start<\/strong> e, pertanto, ti preghiamo di modificarla di conseguenza. Il codice PHP di cui sopra esegue tre istruzioni SQL per tre numeri: il numero di post, il numero di pagine e il numero di commenti. Viene calcolata la differenza di giorno.<\/p>\n<p>Tieni inoltre presente che se hai un plug-in per la cache del tuo blog wordpress, la visualizzazione di informazioni aggiornate quotidianamente potrebbe forzare l&#8217;annullamento della cache una volta al giorno.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">Fonte di registrazione:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/helloacm.com\" class=\"external external_icon\">helloacm.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Come visualizzare le statistiche del blog a pi\u00e8 di pagina?<\/p>\n","protected":false},"author":1,"featured_media":223984,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[896,804,814,844,865],"tags":[1168],"class_list":["post-232985","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-codice","category-php-6","category-plugin-2","category-tutorial","category-wordpress-6","tag-affiai-it"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/posts\/232985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/comments?post=232985"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/posts\/232985\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/media\/223984"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/media?parent=232985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/categories?post=232985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/it\/wp-json\/wp\/v2\/tags?post=232985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}