{"id":232928,"date":"2023-02-01T17:03:00","date_gmt":"2023-02-01T14:03:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=232928"},"modified":"2022-11-10T18:24:13","modified_gmt":"2022-11-10T15:24:13","slug":"como-mostrar-las-estadisticas-del-blog-en-el-pie-de-pagina","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/es\/como-mostrar-las-estadisticas-del-blog-en-el-pie-de-pagina\/","title":{"rendered":"\u00bfC\u00f3mo mostrar las estad\u00edsticas del blog en el pie de p\u00e1gina?"},"content":{"rendered":"<p>Casi todos los temas de wordpress tienen un archivo <strong>footer.php<\/strong> que contiene el dise\u00f1o del pie de p\u00e1gina. Puede insertar el siguiente c\u00f3digo PHP+MySQL para mostrar algunas estad\u00edsticas del blog al final de cada p\u00e1gina.<\/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 fecha en que public\u00f3 su primera publicaci\u00f3n se almacena en la variable PHP <strong>$start<\/strong> y, por lo tanto, modif\u00edquela en consecuencia. El c\u00f3digo PHP anterior ejecuta tres declaraciones SQL para tres n\u00fameros: el n\u00famero de publicaciones, el n\u00famero de p\u00e1ginas y el n\u00famero de comentarios. Se calcula la diferencia de d\u00edas.<\/p>\n<p>Tenga en cuenta tambi\u00e9n que si tiene un complemento de cach\u00e9 de su blog de wordpress, mostrar informaci\u00f3n actualizada diariamente puede forzar la invalidaci\u00f3n de su cach\u00e9 una vez al d\u00eda.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">Fuente de grabaci\u00f3n:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/helloacm.com\" class=\"external external_icon\">helloacm.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00bfC\u00f3mo mostrar las estad\u00edsticas del blog en el pie de p\u00e1gina?<\/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":[892,810,800,840,861],"tags":[1172],"class_list":["post-232928","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-codigo","category-complementos","category-php-2","category-tutoriales","category-wordpress-2","tag-affiai-es"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/es\/wp-json\/wp\/v2\/posts\/232928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/es\/wp-json\/wp\/v2\/comments?post=232928"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/es\/wp-json\/wp\/v2\/posts\/232928\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/es\/wp-json\/wp\/v2\/media\/223984"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/es\/wp-json\/wp\/v2\/media?parent=232928"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/es\/wp-json\/wp\/v2\/categories?post=232928"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/es\/wp-json\/wp\/v2\/tags?post=232928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}