{"id":220028,"date":"2023-01-27T10:19:00","date_gmt":"2023-01-27T07:19:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=220028"},"modified":"2023-01-28T18:16:30","modified_gmt":"2023-01-28T15:16:30","slug":"kak-pokazat-sluchajnye-soobshhenija-v-wordpress-s-pomoshhju-miniatjur","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/ru\/kak-pokazat-sluchajnye-soobshhenija-v-wordpress-s-pomoshhju-miniatjur\/","title":{"rendered":"\u041a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 WordPress \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440?"},"content":{"rendered":"<p>\u0412 <a href=\"https:\/\/wordpress.mediadoma.com\/ru\/kak-pokazat-soobshhenija-istoricheskogo-segodnja-v-wordpress\/\" title=\"\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445\">\u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u0445<\/a> \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u043e\u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u2014 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c. \u0414\u0440\u0443\u0433\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u2014 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u043f\u043e\u0441\u0442\u044b. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u043c\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440\u044b \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0431\u0440\u043e\u0441\u0430\u0442\u044c\u0441\u044f \u0432 \u0433\u043b\u0430\u0437\u0430. \u0422\u0430\u043a \u0447\u0442\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u043c\u0435\u043d\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 (\u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435 <a href=\"https:\/\/wordpress.mediadoma.com\/ru\/kak-pokazat-pohozhie-stati-ispolzuja-sootvetstvujushhij-kontent-iz-google-adsense\/\" title=\"Google match content\">Google match content<\/a> ).<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0438. \u042d\u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0435\u0441\u043b\u0438 [Feature Image] \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438.<\/p>\n<pre><code>\u00a0function catch_first_image($post_id) {\n\u00a0 \u00a0ob_start();\n\u00a0 \u00a0ob_end_clean();\n\u00a0 \u00a0$related_post = get_post($post_id);\n\u00a0 \u00a0$content = $related_post-&gt;post_content;\n\u00a0 \u00a0$output = preg_match_all('\/&lt;img.+src=['\"]([^'\"]+)['\"].*&gt;\/i', $content, $matches);\n\u00a0 \u00a0return $matches[1][0];\n\u00a0} <\/code><\/pre>\n<p>\u0417\u0430\u0442\u0435\u043c \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043a\u0443\u0434\u0430 \u0432\u0430\u043c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, Single.php. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 ($num = 4).<\/p>\n<pre><code>&lt;style&gt;\n.justyyimg {max-width:120px; height: 120px;}\n&lt;\/style&gt;\n\u00a0\n&lt;div id=\"related-posts\"&gt;\n\u00a0 \u00a0 &lt;div class=\"related\" class=\"clearfix\"&gt;\n\u00a0 \u00a0 \u00a0 &lt;?php \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\n\u00a0 \u00a0 \u00a0 $post_num = 4;\n\u00a0 \u00a0 \u00a0 $exclude_id = $post-&gt;id; \n\u00a0 \u00a0 \u00a0 $args = array(\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 'post_status' =&gt; 'publish',\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 'post__not_in' =&gt; explode(',', $exclude_id),\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 'orderby' =&gt; 'rand',\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 'posts_per_page' =&gt; $post_num\n\u00a0 \u00a0 \u00a0 );\n\u00a0 \u00a0 \u00a0 query_posts($args);\n\u00a0 \u00a0 \u00a0 while( have_posts()) { the_post(); ?&gt;\n\u00a0 \u00a0 \u00a0 &lt;a href=\"&lt;?php echo the_permalink(); ?&gt;\" title=\"&lt;?php the_title(); ?&gt;\" &gt;\n\u00a0 \u00a0 \u00a0 &lt;?php \n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (has_post_thumbnail()) {\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 the_post_thumbnail();\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } else {\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 $img = catch_first_image(get_the_id());\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (strlen($img)) {\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 echo \"&lt;img alt='\".get_the_title().\"' class='justyyimg' src=\"\".$img.\"\"\/&gt;\";\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 } else {\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 echo \"&lt;img alt='\".get_the_title().\"' class='justyyimg' src=\"&lt;a class=\"vglnk\" target=\"_blank\" href=\"https:\/\/justyy.com\/jpg\/\".mt_rand\" rel=\"nofollow\"&gt;&lt;span&gt;https&lt;\/span&gt;&lt;span&gt;:\/\/&lt;\/span&gt;&lt;span&gt;justyy&lt;\/span&gt;&lt;span&gt;.&lt;\/span&gt;&lt;span&gt;com&lt;\/span&gt;&lt;span&gt;\/&lt;\/span&gt;&lt;span&gt;jpg&lt;\/span&gt;&lt;span&gt;\/\".&lt;\/span&gt;&lt;span&gt;mt&lt;\/span&gt;&lt;span&gt;_&lt;\/span&gt;&lt;span&gt;rand&lt;\/span&gt;&lt;\/a&gt;(1, 20).\".jpg\"\/&gt;\";\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 }\n\u00a0 \u00a0 \u00a0 ?&gt;&lt;\/a&gt;\n\u00a0 \u00a0 \u00a0 &lt;?php\n\u00a0 \u00a0 \u00a0 \u00a0 $exclude_id .= ','. get_the_id(); \u00a0 \u00a0 \u00a0 \u00a0 \n\u00a0 \u00a0 \u00a0 } \n\u00a0 \u00a0 \u00a0 wp_reset_query();\n\u00a0 \u00a0 \u00a0 ?&gt;\n\u00a0 \u00a0 &lt;\/div&gt;\n&lt;\/div&gt; \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<\/code><\/pre>\n<p>\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <strong>has_post_thumbnail()<\/strong>, \u0447\u0442\u043e\u0431\u044b \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439.<\/p>\n<pre><code>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if (has_post_thumbnail()) {\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 the_post_thumbnail();<\/code><\/pre>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0438\u0437\u043c\u0435\u043d\u0438\u0432 \u0437\u0430\u043f\u0440\u043e\u0441.<\/p>\n<p>\u2013\u0423\u0442\u043e\u0447\u043d\u044f\u0435\u0442\u0441\u044f\u2013<\/p>\n<p>\u0420\u0435\u0439\u0442\u0438\u043d\u0433: 10.0\/ <strong>10<\/strong> (1 \u0433\u043e\u043b\u043e\u0441)<\/p>\n<p>403 \u0441\u043b\u043e\u0432\u0430<br \/>\n<strong>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435<\/strong>: <a href=\"https:\/\/wordpress.mediadoma.com\/ru\/kak-pokazat-soobshhenija-istoricheskogo-segodnja-v-wordpress\/\" title=\"\u041a\u0430\u043a \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u00ab\u0421\u0435\u0433\u043e\u0434\u043d\u044f\u00bb \u0432 WordPress?\">\u041a\u0430\u043a \u043e\u0442\u043e\u0431\u0440\u0430\u0437\u0438\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u00ab\u0421\u0435\u0433\u043e\u0434\u043d\u044f\u00bb \u0432 WordPress?<\/a><br \/>\n<strong>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435<\/strong>: <a href=\"https:\/\/wordpress.mediadoma.com\/ru\/plagin-wp-rocket-objazatelen-dlja-polzovatelej-wordpress\/\" title=\"\u041f\u043b\u0430\u0433\u0438\u043d WP-Rocket \u2014 must have \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 WordPress!\">\u041f\u043b\u0430\u0433\u0438\u043d WP-Rocket \u2014 must have \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 WordPress!<\/a><\/p>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0437\u0430\u043f\u0438\u0441\u0438:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/helloacm.com\" class=\"external external_icon\">helloacm.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 WordPress \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0438\u043d\u0438\u0430\u0442\u044e\u0440?<\/p>\n","protected":false},"author":1,"featured_media":223922,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[809,870,900,990,921,618,850],"tags":[1171],"class_list":["post-220028","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php-ru","category-wordpress-ru","category-kod-2","category-kontent-marketing","category-drugoj","category-rukovodstvo-dlja-nachinajushhih","category-uchebniki-ru","tag-affiai-ru"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/220028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/comments?post=220028"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/220028\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media\/223922"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media?parent=220028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/categories?post=220028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/tags?post=220028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}