{"id":232975,"date":"2023-02-02T15:23:00","date_gmt":"2023-02-02T12:23:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=232975"},"modified":"2022-11-10T18:36:09","modified_gmt":"2022-11-10T15:36:09","slug":"jak-stvoriti-storinku-wordpress-jaka-pokazuie-statistiku-komentariv","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/uk\/jak-stvoriti-storinku-wordpress-jaka-pokazuie-statistiku-komentariv\/","title":{"rendered":"\u042f\u043a \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0443 WordPress, \u044f\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0443\u0454 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0456\u0432?"},"content":{"rendered":"<p>WordPress \u0431\u0430\u0437\u0443\u0454\u0442\u044c\u0441\u044f \u043d\u0430 PHP \u0456 MySQL. \u0422\u043e\u043c\u0443 \u0432\u0456\u043d \u0434\u0443\u0436\u0435 \u0433\u043d\u0443\u0447\u043a\u0438\u0439 \u0456 \u043f\u043e\u0442\u0443\u0436\u043d\u0438\u0439. \u0423 \u0446\u0456\u0439 \u0441\u0442\u0430\u0442\u0442\u0456 \u0432\u0438 \u0434\u0456\u0437\u043d\u0430\u0454\u0442\u0435\u0441\u044f, \u044f\u043a \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0443 \u0437\u0456 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u043e\u044e \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0456\u0432 \u0434\u043b\u044f \u0432\u0430\u0448\u043e\u0433\u043e \u0431\u043b\u043e\u0433\u0443. \u041d\u0430\u043f\u0440\u0438\u043a\u043b\u0430\u0434, \u0442\u0430\u0431\u043b\u0438\u0446\u044f \u0437 \u0434\u0432\u043e\u043c\u0430 \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c\u0438, \u0430\u0432\u0442\u043e\u0440\u043e\u043c \u0456 \u043a\u0456\u043b\u044c\u043a\u0456\u0441\u0442\u044e \u0439\u043e\u0433\u043e \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0456\u0432.<\/p>\n<p>\u0429\u043e\u0431 \u0443\u0432\u0456\u043c\u043a\u043d\u0443\u0442\u0438 PHP-\u043a\u043e\u0434, \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0431\u0443\u0434\u0435 \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0438 \u043f\u043b\u0430\u0433\u0456\u043d, \u044f\u043a\u0438\u0439 \u0434\u043e\u0437\u0432\u043e\u043b\u044f\u0454 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u0438 PHP-\u043a\u043e\u0434 \u0443 \u0432\u0430\u0448\u0456 \u043f\u0443\u0431\u043b\u0456\u043a\u0430\u0446\u0456\u0457\/\u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0438. \u042f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0448\u0443\u043a\u0430\u0442\u0438 [Simple Include HTML and PHP] \u043d\u0430 \u043f\u0430\u043d\u0435\u043b\u0456 \u043a\u0435\u0440\u0443\u0432\u0430\u043d\u043d\u044f WordPress.<\/p>\n<p>\u041f\u043e\u0442\u0456\u043c \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0456\u0431\u043d\u043e \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0443, \u044f\u043a\u0430 \u043c\u0430\u0454 \u043f\u0440\u0438\u043d\u0430\u0439\u043c\u043d\u0456 \u043d\u0430\u0441\u0442\u0443\u043f\u043d\u0435 (\u043f\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043e \u0447\u0435\u0440\u0432\u043e\u043d\u0438\u043c).<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-155258-61e5590d1c782.jpg\" data-rel=\"lightbox\" ><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-155258-61e5590d1c782.jpg\" alt=\"\u042f\u043a \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0443 Wordpress, \u044f\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0443\u0454 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0456\u0432?\" ><\/a><\/p>\n<p>\u041f\u043b\u0430\u0433\u0456\u043d WordPress \u0434\u043b\u044f \u043f\u043e\u043a\u0430\u0437\u0443 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0456\u0432<\/p>\n<p>\u041f\u043e\u0442\u0456\u043c \u043f\u0435\u0440\u0435\u0439\u0434\u0456\u0442\u044c \u0434\u043e \u0441\u0432\u043e\u0454\u0457 \u043f\u0430\u043f\u043a\u0438 \u0442\u0435\u043c\u0438 \u0442\u0430 \u0441\u0442\u0432\u043e\u0440\u0456\u0442\u044c \u0444\u0430\u0439\u043b \u0456\u0437 \u043d\u0430\u0437\u0432\u043e\u044e <strong>cmt.php<\/strong> \u0456 \u0432\u0441\u0442\u0430\u043d\u043e\u0432\u0456\u0442\u044c \u0440\u0435\u0436\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0443 \u0434\u043e \u0444\u0430\u0439\u043b\u0443 644 (\u0430\u0431\u043e \u043f\u0440\u0438\u043d\u0430\u0439\u043c\u043d\u0456 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0438\u0439 \u0434\u043b\u044f \u0447\u0438\u0442\u0430\u043d\u043d\u044f).<\/p>\n<p>\u041a\u043e\u0434 PHP \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u0432\u043d\u0435\u043d\u043d\u044f \u0444\u0430\u0439\u043b\u0443:<\/p>\n<pre><code>&lt;?php\n\/\/&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\u00a0 global $wpdb;\n\u00a0 $query = \"\n \u00a0 \u00a0select \n \u00a0 \u00a0 \u00a0`comment_author`, \n \u00a0 \u00a0 \u00a0`comment_author_url`,\n \u00a0 \u00a0 \u00a0count(1) as `cnt` \n \u00a0 \u00a0from\n \u00a0 \u00a0 \u00a0`wp_comments`\n \u00a0 \u00a0where\n \u00a0 \u00a0 \u00a0`comment_approved` = 1 \u00a0 \u00a0 \u00a0\n \u00a0 \u00a0group by \n \u00a0 \u00a0 \u00a0`comment_author`\n \u00a0 \u00a0order by\n \u00a0 \u00a0 \u00a0`cnt` desc\n \u00a0 \u00a0limit 10 \n \u00a0\";\n\u00a0 \n\u00a0 $result = $wpdb-&gt;get_results($query);\n\u00a0 if ($result) {\n\u00a0 \u00a0 echo \"&lt;table width='100%' style='border:0'&gt;\";\n\u00a0 \u00a0 echo \"&lt;tr&gt;&lt;b&gt;&lt;td&gt;Author&lt;\/td&gt;&lt;td&gt;The Number of Comments&lt;\/td&gt;&lt;\/b&gt;&lt;\/tr&gt;\";\n\u00a0 \u00a0 foreach ($result as $author) {\n\u00a0 \u00a0 \u00a0 echo \"&lt;tr&gt;\";\n\u00a0 \u00a0 \u00a0 $a = esc_sql($author-&gt;comment_author);\n\u00a0 \u00a0 \u00a0 $query = \"\n \u00a0 \u00a0 \u00a0 \u00a0select \n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0`comment_post_id`,\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0`comment_id`\n \u00a0 \u00a0 \u00a0 \u00a0from\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0`wp_comments`\n \u00a0 \u00a0 \u00a0 \u00a0where\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0`comment_approved` = 1 and\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0`comment_author` = '$a'\n \u00a0 \u00a0 \u00a0 \u00a0order by\n \u00a0 \u00a0 \u00a0 \u00a0 \u00a0`comment_date` desc\n \u00a0 \u00a0 \u00a0 \u00a0limit 1 \u00a0 \u00a0 \u00a0\n \u00a0 \u00a0 \u00a0\";\n\u00a0 \u00a0 \u00a0 $latest = $wpdb-&gt;get_row($query);\n\u00a0 \u00a0 \u00a0 echo \"&lt;td&gt;&lt;a href='$author-&gt;comment_author_url' target='_blank' title='$author-&gt;comment_author'&gt;\".$author-&gt;comment_author.\"&lt;\/a&gt;&lt;\/td&gt;\";\n\u00a0 \u00a0 \u00a0 echo \"&lt;td&gt;&lt;a title='$author-&gt;comment_author' href='\/archives\/$latest-&gt;comment_post_id\/#comment-$latest-&gt;comment_id'&gt;\".$author-&gt;cnt.\"&lt;\/a&gt;&lt;\/td&gt;\"; \u00a0 \u00a0 \u00a0\n\u00a0 \u00a0 \u00a0 echo \"&lt;\/tr&gt;\";\n\u00a0 \u00a0 }\n\u00a0 \u00a0 echo \"&lt;\/table&gt;\";\n\u00a0 } \n?&gt;<\/code><\/pre>\n<p>\u041d\u0430\u0442\u0438\u0441\u043d\u0443\u0432\u0448\u0438 [\u0410\u0432\u0442\u043e\u0440], \u0432\u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442\u0435 \u0434\u043e \u043d\u0430\u0434\u0430\u043d\u043e\u0457 URL-\u0430\u0434\u0440\u0435\u0441\u0438 (\u0443 \u043d\u043e\u0432\u043e\u043c\u0443 \u0432\u0456\u043a\u043d\u0456), \u0430 \u043d\u0430\u0442\u0438\u0441\u043d\u0443\u0432\u0448\u0438 [\u041a\u0456\u043b\u044c\u043a\u0456\u0441\u0442\u044c \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0456\u0432], \u0432\u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u0442\u0435 \u0434\u043e \u043e\u0441\u0442\u0430\u043d\u043d\u044c\u043e\u0433\u043e \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u044f. \u0424\u043e\u0440\u043c\u0430\u0442 URL-\u0430\u0434\u0440\u0435\u0441\u0438 \u043c\u043e\u0436\u0435 \u0437\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0438\u0441\u044f \u0437\u043c\u0456\u043d\u0438\u0442\u0438, \u044f\u043a\u0449\u043e \u0432\u0456\u043d \u043d\u0435 \u0454 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0438\u043c [\/archives\/post_id].<\/p>\n<p>\u0417\u0440\u0430\u0437\u043e\u043a \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0438 \u043c\u043e\u0436\u043d\u0430 \u043f\u0435\u0440\u0435\u0433\u043b\u044f\u043d\u0443\u0442\u0438 \u0442\u0443\u0442: <a href=\"https:\/\/justyy.com\/commentator\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">https:\/\/justyy.com\/commentator<\/a> (\u043a\u0438\u0442\u0430\u0439\u0441\u044c\u043a\u043e\u044e).<\/p>\n<p>\u0424\u0443\u043d\u043a\u0446\u0456\u044f PHP <strong>mysql_real_escape_string()<\/strong> \u0437\u0430\u0441\u0442\u0430\u0440\u0456\u043b\u0430, \u0430\u043b\u0435 \u0432\u0438 \u0432\u0441\u0435 \u0449\u0435 \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u0432\u0430\u0442\u0438 <strong>esc_sql<\/strong> \u0430\u0431\u043e <strong>$wpdb-&gt;prepare()<\/strong> \u0434\u043b\u044f \u0435\u043a\u0440\u0430\u043d\u0443\u0432\u0430\u043d\u043d\u044f \u0440\u044f\u0434\u043a\u0456\u0432 (\u0449\u043e \u043c\u0456\u0441\u0442\u044f\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u0440\u043d\u0456 \u0430\u0431\u043e \u043f\u043e\u0434\u0432\u0456\u0439\u043d\u0456 \u043b\u0430\u043f\u043a\u0438) \u0434\u043b\u044f SQL\/\u0431\u0430\u0437\u0438 \u0434\u0430\u043d\u0438\u0445.<\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0414\u0436\u0435\u0440\u0435\u043b\u043e \u0437\u0430\u043f\u0438\u0441\u0443:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/helloacm.com\" class=\"external external_icon\">helloacm.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u042f\u043a \u0441\u0442\u0432\u043e\u0440\u0438\u0442\u0438 \u0441\u0442\u043e\u0440\u0456\u043d\u043a\u0443 WordPress, \u044f\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0443\u0454 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u0456\u0432?<\/p>\n","protected":false},"author":1,"featured_media":224768,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[808,869,839,902,849,725],"tags":[1174],"class_list":["post-232975","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-10","category-wordpress-10","category-kerivnytstvo-dlia-pochatkivtsiv","category-kod-3","category-pidruchnyky","category-rozrobnyk","tag-affiai-uk"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/232975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/comments?post=232975"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/posts\/232975\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media\/224768"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/media?parent=232975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/categories?post=232975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/uk\/wp-json\/wp\/v2\/tags?post=232975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}