{"id":220351,"date":"2023-02-22T18:27:00","date_gmt":"2023-02-22T15:27:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=220351"},"modified":"2022-08-10T06:14:16","modified_gmt":"2022-08-10T03:14:16","slug":"vse-o-dobavlenii-stilej-i-skriptov-v-wordpress","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/ru\/vse-o-dobavlenii-stilej-i-skriptov-v-wordpress\/","title":{"rendered":"\u0412\u0441\u0435 \u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0432 WordPress"},"content":{"rendered":"\n<p>WordPress \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0434\u043b\u044f \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430, \u043a\u0430\u043a \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445\/\u0432\u044b\u0432\u043e\u0434\u0430. \u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u0441\u0442\u0438\u043b\u0438 \u0432 WordPress.<\/p>\n<p>\u0421\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u0441\u0442\u0438\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0443\u0442\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432 (\u0441\u043b\u0430\u0433-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u0432), \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 WordPress \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u044b, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a jQuery, \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 (\u043a\u0430\u043a\u043e\u0439 \u0441\u0442\u0438\u043b\u044c \u0438\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u0438 \u044d\u0442\u0438\u043c) .<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u043e\u0441\u043e\u0431\u043e\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0438\u043b\u0435\u0439 \u0438\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0438\u0445 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0440\u0430\u0437\u0443, \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044e \u0438\u043b\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0437 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 \u0441\u0442\u0438\u043b\u0438 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b (<code>wp_dequeue_script<\/code>\u0438 <code>wp_dequeue_style<\/code>), \u043e\u0431\u0440\u0430\u0442\u0438\u0432\u0448\u0438\u0441\u044c \u043a \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0443. \u041e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442 \u0445\u0443\u043a\u0430 (\u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u043f\u043e\u0441\u043b\u0435 \u0445\u0443\u043a\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0431\u044b\u043b\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c).<\/p>\n<p>PS: \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0432 \u0413\u0443\u0442\u0435\u043d\u0431\u0435\u0440\u0433 (\u043a\u0430\u043a \u0430\u0434\u043c\u0438\u043d\u043a\u0443, \u0442\u0430\u043a \u0438 \u0444\u0440\u043e\u043d\u0442\u044d\u043d\u0434-\u0431\u043b\u043e\u043a\u0438) \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u043c\u043e\u0435\u043c \u043f\u043e\u0441\u0442\u0435 <a href=\"http:\/\/localhost\/awhitepixel\/blog\/gutenberg-the-basics\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u0413\u0443\u0442\u0435\u043d\u0431\u0435\u0440\u0433: \u041e\u0441\u043d\u043e\u0432\u044b<\/a>.<\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438 \u0441\u0442\u0438\u043b\u0435\u0439 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441<\/h2>\n<p>\u0414\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0445\u0443\u043a <code>wp_enqueue_scripts<\/code>. \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0445\u0443\u043a\u0430, \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0441\u0442\u0438\u043b\u0435\u0439. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u0444\u0430\u0439\u043b\u0430 javascript \u0432 \u0442\u0435\u043c\u0435:<\/p>\n<pre><code>add_action('wp_enqueue_scripts', function() {\n    \/\/ Styles\n    wp_enqueue_style('main-style', get_stylesheet_directory_uri().'\/style.css', [], '1.0');\n\u00a0\n    \/\/ Scripts\n    wp_enqueue_script('main-script', get_stylesheet_directory_uri().'\/assets\/js\/main.js', ['jquery'], '', true);\n});<\/code><\/pre>\n<p>\u0422\u0440\u0435\u0442\u0438\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0438 \u0441\u0442\u0438\u043b\u0435\u0439, \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u2014 \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 \u0441 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u044f\u043c\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 jQuery \u043f\u0435\u0440\u0435\u0434 \u0444\u0430\u0439\u043b\u043e\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f. <strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/strong>. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 WordPress \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043d\u0430\u0431\u043e\u0440\u043e\u043c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, jQuery, jQuery UI, Backbone \u0438 Underscore). \u0415\u0441\u043b\u0438 \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_enqueue_script\/#default-scripts-included-and-registered-by-wordpress\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">\u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u0438\u0437 \u044d\u0442\u0438\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432<\/a> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0432\u0430\u0448 enqueue_script, WordPress \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442 \u0438\u0445 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a.<\/p>\n<p>\u041f\u044f\u0442\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043b\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0432 \u043a\u043e\u043d\u0446\u0435 <code>&lt;body&gt;<\/code>(\u0432 \u043d\u0438\u0436\u043d\u0435\u043c \u043a\u043e\u043b\u043e\u043d\u0442\u0438\u0442\u0443\u043b\u0435), \u0430 \u043d\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 <code>&lt;head&gt;<\/code>\u0442\u0435\u0433\u0430.<\/p>\n<p>\u0414\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u043f\u043b\u0430\u0433\u0438\u043d\u0435 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c URL-\u0430\u0434\u0440\u0435\u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>plugin_dir_url(__FILE__)<\/code>.<\/p>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438 \u0441\u0442\u0438\u043b\u0435\u0439 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0443<\/h2>\n<p>WordPress \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0445\u0443\u043a, <code>admin_enqueue_scripts<\/code>\u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0438\u043b\u0435\u0439 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0443. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0442\u0435 \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u0447\u0442\u043e \u0438 \u0432\u044b\u0448\u0435, \u0434\u043b\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438, \u043f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0438 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438 \u0441\u0442\u0438\u043b\u0435\u0439:<\/p>\n<pre><code>add_action('admin_enqueue_scripts', function() {\n    global $pagenow, $post_type;\n    \/\/ Example: $hook == 'edit.php'\n    \/\/ Example: $post_type == 'post'\n    \/\/ wp_enqueue_style or wp_enqueue_script\n});<\/code><\/pre>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438 \u0441\u0442\u0438\u043b\u0435\u0439 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0432\u0445\u043e\u0434\u0430<\/h2>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u0445 \u0445\u0443\u043a\u043e\u0432 \u043d\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0432\u0445\u043e\u0434\u0430 \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440\u0430, WordPress \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0445\u0443\u043a, <code>login_enqueue_scripts<\/code>.<\/p>\n<pre><code>add_action('login_enqueue_scripts', function() {\n    \/\/ wp_enqueue_style or wp_enqueue_script\n});<\/code><\/pre>\n<h2>\u0412\u044b\u0432\u043e\u0434 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 Javascript<\/h2>\n<p>\u0414\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 Javascript (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0435\u0439, \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u043e\u043a \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445) \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c wp_localize_script. \u0414\u043b\u044f \u044d\u0442\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0441\u043a\u0440\u0438\u043f\u0442\u0430, \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c. \u0412\u0442\u043e\u0440\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0430 \u0442\u0440\u0435\u0442\u044c\u0438\u043c \u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0430\u0441\u0441\u0438\u0432\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 :<\/p>\n<pre><code>add_action('wp_enqueue_scripts', function() {\n    \/\/ wp_enqueue_script('main-script');  \/\/ Must exist!\n    $variable_to_js = [\n        'ajax_url' =&gt; admin_url('admin-ajax.php')\n    ];\n    wp_localize_script('main-script', 'Theme_Variables', $variable_to_js);\n});<\/code><\/pre>\n<p>\u0412\u043d\u0443\u0442\u0440\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code>jQuery(document).ready(function($) { \n    console.log(Theme_Variables.ajax_url);\n});<\/code><\/pre>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0445\u0443\u043a\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c <code>$pagenow<\/code>\u0438 <code>$post_type<\/code>\u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u0433\u0434\u0435 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0432\u043e\u0438 \u0441\u0442\u0438\u043b\u0438 \u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b.<\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0438\u043b\u0435\u0439<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u0438\u043b\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0442\u0435\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u044b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043b\u0438 \u0432 Customizer (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>get_theme_mod<\/code>), \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>wp_add_inline_style<\/code>\u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u042d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u0432\u044b\u0432\u043e\u0434 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 Javascript, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440 \u0441\u0442\u0438\u043b\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438:<\/p>\n<pre><code>add_action('wp_enqueue_scripts', function() {\n    \/\/ wp_enqueue_style('main-style');  \/\/ Must exist!\n\u00a0\n    $color = get_theme_mod('my-custom-color');  \/\/ e.g. #FF0000\n    $custom_css = \"\n        body {\n            background: {$color};\n        }\";\n        wp_add_inline_style('main-style', $custom_css);\n});<\/code><\/pre>\n<h2>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u0442\u0435\u0433\u043e\u0432 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u044b<\/h2>\n<p>\u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043d\u0435\u0442 \u043f\u0440\u044f\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u043b\u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f <code>async<\/code>\u043a \u0432\u0430\u0448\u0438\u043c \u0442\u0435\u0433\u0430\u043c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f, \u043d\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0433\u043e, \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u0443\u044f \u0441\u0442\u0440\u043e\u043a\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0443\u044e WordPress \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0442\u0435\u0433\u043e\u0432 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a (\u043d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043f\u043e \u0435\u0433\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0443):<\/p>\n<pre><code>add_filter('script_loader_tag', function($tag, $handle, $src) {\n    if ('main-script' != $handle) {\n        return $tag;\n    }\n    return str_replace('&lt;script', '&lt;script async', $tag);\n}, 11, 3);<\/code><\/pre>\n<h2>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e<\/h2>\n<ul>\n<li><a href=\"https:\/\/codex.wordpress.org\/Plugin_API\/Action_Reference\/wp_enqueue_scripts\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">wp_enqueue_scripts<\/a> (\u043a\u0440\u044e\u0447\u043e\u043a)<\/li>\n<li><a href=\"https:\/\/codex.wordpress.org\/Plugin_API\/Action_Reference\/admin_enqueue_scripts\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">admin_enqueue_scripts<\/a> (\u043a\u0440\u044e\u0447\u043e\u043a)<\/li>\n<li><a href=\"https:\/\/codex.wordpress.org\/Plugin_API\/Action_Reference\/login_enqueue_scripts\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">login_enqueue_scripts<\/a> (\u043a\u0440\u044e\u0447\u043e\u043a)<\/li>\n<li><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_enqueue_style\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">wp_enqueue_style<\/a><\/li>\n<li><a href=\"https:\/\/codex.wordpress.org\/Function_Reference\/wp_dequeue_style\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">wp_dequeue_style<\/a><\/li>\n<li><a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_enqueue_script\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">wp_enqueue_script<\/a><\/li>\n<li><a href=\"https:\/\/codex.wordpress.org\/Function_Reference\/wp_dequeue_script\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">wp_dequeue_script<\/a><\/li>\n<li><a href=\"https:\/\/codex.wordpress.org\/Function_Reference\/wp_localize_script\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">wp_localize_script<\/a><\/li>\n<li><a href=\"https:\/\/codex.wordpress.org\/Function_Reference\/wp_add_inline_style\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">wp_add_inline_style<\/a><\/li>\n<\/ul>\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=\"\/\/awhitepixel.com\" class=\"external external_icon\">awhitepixel.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412 \u044d\u0442\u043e\u043c \u043f\u043e\u0441\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u043c\u0438 \u043a\u043e\u0434\u0430 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438 \u0441\u0442\u0438\u043b\u0438 \u0432 WordPress, \u043a\u0430\u043a \u0432 \u0444\u0430\u0439\u043b\u044b, \u0442\u0430\u043a \u0438 \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435.<\/p>\n","protected":false},"author":1,"featured_media":224083,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[900,726,809,809,618,934,870,870,900,726,618,934,850],"tags":[1171],"class_list":["post-220351","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kod-2","category-rozrobnyk-ru","category-php-ru","category-rukovodstvo-dlja-nachinajushhih","category-temy","category-wordpress-ru","category-uchebniki-ru","tag-affiai-ru"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/220351","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=220351"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/220351\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media\/224083"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media?parent=220351"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/categories?post=220351"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/tags?post=220351"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}