{"id":40317,"date":"2021-10-21T11:15:59","date_gmt":"2021-10-21T09:15:59","guid":{"rendered":"https:\/\/kinsta.com\/?p=4230"},"modified":"2023-06-08T13:13:40","modified_gmt":"2023-06-08T11:13:40","slug":"wp-enqueue-scripts","status":"publish","type":"post","link":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/","title":{"rendered":"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress"},"content":{"rendered":"<p>In WordPress kan je het beste een gestandardiseerde methode gebruiken die &#8220;enqueueing&#8221; heet om al je benodigde bestanden in klaar te zetten. Je voegt ze dus niet gewoon toe aan de header, maar plaatst ze zelf in een wachtrij. Bijkomend voordeel is dat je op deze manier ook afhankelijkheden kan beheren tussen je bestanden. In dit artikel lees je hoe je dit doet door middel van\u00a0<code>wp_enqueue_scripts<\/code>.<\/p>\n<ul>\n<li><a href=\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#how-enqueueing-works\">Zo werkt enqueueing<\/a><\/li>\n<li><a href=\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#enqueueing-basics\">Introductie over enqueueing met wp_enqueue_scripts<\/a><\/li>\n<li><a href=\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#dependency-management\">Beheer van afhankelijkheden<\/a><\/li>\n<li><a href=\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#load-scripts-in-footer\">Laden van scripts in de footer<\/a><\/li>\n<li><a href=\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#specifying-media-for-styles\">Specificeren van media voor styles<\/a><\/li>\n<\/ul>\n<h2 id=\"how-enqueueing-works\">Zo werkt enqueueing<\/h2>\n<p>Je moet twee dingen doen bij het in de wachtrij plaatsen van een script of style. Allereerst moet je het bestand registreren, zodat WordPress weet dat het bestand er staat. Vervolgens plaats je het daadwerkelijk in de wachtrij, &#8220;enqueueing&#8221;, waardoor het in de header of net voor de laatste body tag geplaatst wordt.<\/p>\n<p>Modulariteit is de voornaamste reden dat dit proces uit twee stappen bestaat. Soms wil je een bestand registreren bij WordPress, maar heb je het niet op elke pagina nodig. Stel bijvoorbeeld dat je een shortcode voor een custom gallery aan het maken bent door middel van JavaScript. Dan hoef je de JS eigenlijk alleen te laden op de pagina&#8217;s waar de shortcode gebruikt wordt.<\/p>\n<p>Dit kan je doen door eerst het script te registreren, en het pas in de wachtrij voor laden te plaatsen wanneer de shortcode getoond wordt (lees ook eens: <a href=\"https:\/\/kinsta.com\/nl\/blog\/wordpress-shortcodes\/\">The Ultimate Guide to WordPress Shortcodes<\/a>).<\/p>\n<h2 id=\"enqueueing-basics\">Introductie over enqueueing met wp_enqueue_scripts<\/h2>\n<p>Om script en styles in de front-end te enqueuen, zal je de <code>wp_enqueue_scripts<\/code> hook moeten gebruiken. Binnen deze hook kan je gebruik maken van de functies <code>wp_register_script()<\/code>, <code>wp_enqueue_script()<\/code>, <code>wp_register_style()<\/code> en <code>wp_enqueue_style()<\/code>.<\/p>\n<pre><code class=\"language-php\">add_action( 'wp_enqueue_scripts', 'my_plugin_assets' );\nfunction my_plugin_assets() {\n    wp_register_style( 'custom-gallery', plugins_url( '\/css\/gallery.css' , __FILE__ ) );\n    wp_register_script( 'custom-gallery', plugins_url( '\/js\/gallery.js' , __FILE__ ) );\n\n    wp_enqueue_style( 'custom-gallery' );\n    wp_enqueue_script( 'custom-gallery' );\n}<\/code><\/pre>\n<p>In het bovenstaande voorbeeld heb ik de benodigde bestanden binnen dezelfde functie geregistreerd en in de wachtrij voor laden geplaatst, wat een beetje dubbel is. Je kan namelijk ook de enqueue functies gebruiken om bestanden tegelijk te registreren en in de wachtrij te plaatsen, door dezelfde argumenten te gebruiken als in de registratie-functies:<\/p>\n<pre><code class=\"language-php\">add_action( 'wp_enqueue_scripts', 'my_plugin_assets' );\nfunction my_plugin_assets() {\n    wp_enqueue_style( 'custom-gallery', plugins_url( '\/css\/gallery.css' , __FILE__ ) );\n    wp_enqueue_script( 'custom-gallery', plugins_url( '\/js\/gallery.js' , __FILE__ ) );\n}<\/code><\/pre>\n<p>Als ik de twee functies zou willen scheiden, zou ik dat doen door ze in verschillende <a href=\"https:\/\/kinsta.com\/nl\/blog\/wordpress-hooks\/\">hooks<\/a> te gebruiken. In een praktijksituatie zouden we de hook <code>wp_enqueue_scripts<\/code> gebruiken om de assets te registreren, en de functie van de shortcode om ze vervolgens in de wachtrij te plaatsen.<\/p>\n<pre><code class=\"language-php\">add_action( 'wp_enqueue_scripts', 'my_plugin_assets' );\nfunction my_plugin_assets() {\n    wp_register_style( 'custom-gallery', plugins_url( '\/css\/gallery.css' , __FILE__ ) );\n    wp_register_script( 'custom-gallery', plugins_url( '\/js\/gallery.js' , __FILE__ ) );\n\n}\n\nadd_shortcode( 'custom_gallery', 'custom_gallery' );\n\nfunction custom_gallery( $atts ){\n\n    wp_enqueue_style( 'custom-gallery' );\n    wp_enqueue_script( 'custom-gallery' );\n\n    \/\/ Gallery code here\n}<\/code><\/pre>\n<h2 id=\"dependency-management\">Beheer van dependencies<\/h2>\n<p>Het mechanisme voor enqueueing in WordPress biedt ingebouwde ondersteuning voor het beheren van afhankelijkheden, dependencies, door middel van het derde argumenten voor de functies <code>wp_register_style()<\/code> en <code>wp_register_script()<\/code>. Je kan ook de enqueueing functies zelf gebruiken als je deze acties niet wil scheiden.<\/p>\n<p>De derde parameter is een array van geregistreerde scripts en\/of styles die geladen moeten worden voordat de volgende asset geladen wordt. Het eerdere voorbeeld zou waarschijnlijk jQuery gebruiken, dus laten we dat ook hier specificeren:<\/p>\n<pre><code class=\"language-php\">add_action( 'wp_enqueue_scripts', 'my_plugin_assets' );\nfunction my_plugin_assets() {\n    wp_enqueue_script( 'custom-gallery', plugins_url( '\/js\/gallery.js' , __FILE__ ), array( 'jquery' ) );\n}<\/code><\/pre>\n<p>We hoeven jQuery niet apart te registreren en te laden, omdat het al ingebouwd zit in WordPress zelf. Je kan een lijst van <a href=\"https:\/\/codex.wordpress.org\/Function_Reference\/wp_enqueue_script#Default_Scripts_Included_and_Registered_by_WordPress\">beschikbare scripts en styles in WordPress<\/a> vinden in de Codex.<\/p>\n<p>Als je eigen afhankelijkheden hebt, moet je die ook registreren, anders zullen je scripts niet werken. Hier is een voorbeeld:<\/p>\n<pre><code class=\"language-php\">add_action( 'wp_enqueue_scripts', 'my_plugin_assets' );\nfunction my_plugin_assets() {\n    wp_enqueue_script( 'custom-gallery', plugins_url( '\/js\/gallery.js' , __FILE__ ), array( 'jquery' ) );\n    wp_enqueue_script( 'custom-gallery-lightbox', plugins_url( '\/js\/gallery-lightbox.js' , __FILE__ ), array( 'custom-gallery' ) );\n}<\/code><\/pre>\n<p>Laten we aannemen dat het eerste script een galerij is en de tweede een uitbreiding daarop, waardoor afbeeldingen binnen een lightbox geopend worden. Let op dat alhoewel ons tweede script jQuery gebruikt, we dit niet hoeven te specificeren, aangezien het eerste script jQuery al laadt. Toch kan het een goed idee zijn om alle afhankelijkheden te noemen, om er zeker van te zijn dat er niks kapot gaat als je later dingen aanpast.<\/p>\n<p>WordPress weet nu welke scripts er nodig zijn, en kan de volgorde bepalen waarop ze toegevoegd moeten worden aan de pagina.<\/p>\n<h2 id=\"load-scripts-in-footer\">Laden van scripts in de footer<\/h2>\n<p>Wanneer je scripts in de footer kan laden, moet je dit altijd doen. Hierdoor kan de pagina sneller weergegeven worden voor bezoekers, en voorkom je dat je website traag wordt tijdens het laden van scripts, zeker wanneer ze <a href=\"https:\/\/kinsta.com\/nl\/blog\/admin-ajax\/\">AJAX calls<\/a> bevatten.<\/p>\n<p>Het mechanisme voor enqueueing kan scripts toevoegen aan de footer via de vijfde parameter (de vierde parameter is een optioneel versienummer). Ons bovenstaande voorbeeld zou de scripts in de footer kunnen laden, met enkele kleine aanpassingen.<\/p>\n<pre><code class=\"language-php\">add_action( 'wp_enqueue_scripts', 'my_plugin_assets' );\nfunction my_plugin_assets() {\n    wp_enqueue_script( 'custom-gallery', plugins_url( '\/js\/gallery.js' , __FILE__ ), array( 'jquery' ), '1.0', true );\n    wp_enqueue_script( 'custom-gallery-lightbox', plugins_url( '\/js\/gallery-lightbox.js' , __FILE__ ), array( 'custom-gallery', 'jquery' ), '1.0', true );\n}<\/code><\/pre>\n<p>Door de vijfde parameter op &#8217;true&#8217; te zetten worden scripts in de footer geplaatst, en als je niks definieert of &#8216;false&#8217; gebruikt, wordt alles geladen in de header. Zoals eerder gezegd is het laden van scripts in de footer, wanneer mogelijk, altijd beter.<\/p>\n<h2 id=\"specifying-media-for-styles\">Specificeren van media voor styles<\/h2>\n<p>Door de vijfde parameter van de register of enqueue functie voor een style te gebruiken, kan je het mediatype bepalen waar het script voor gedefinieerd wordt (bijv. print, screen, mobile). Door deze parameter te gebruiken kan je het laden van styles voor bepaalde apparaten beperken, wat handig kan zijn voor optimalisatie.<\/p>\n<pre><code class=\"language-php\">add_action( 'wp_enqueue_scripts', 'my_plugin_assets' );\nfunction my_plugin_assets() {\n    wp_register_style( 'custom-gallery-print', plugins_url( '\/css\/gallery.css' , __FILE__ ), array(), '1.0', 'print' );\n\n}<\/code><\/pre>\n<p>Voor een volledige lijst van mediatypen dat je kan gebruiken, kan je kijken in de <a href=\"http:\/\/www.w3.org\/TR\/CSS2\/media.html#media-types\">specificatie van CSS<\/a>.<\/p>\n<h2>Samenvatting<\/h2>\n<p>Het enqueuen van assets is een handige manier om ze te beheren. Hierdoor krijg je zelf, maar ook andere plugin- of thema-developers, meer controle over het hele systeem, waardoor je ook het beheer van afhankelijkheden kan vereenvoudigen.<\/p>\n<p>Als dat nog niet genoeg voordelen zijn, het is ook <strong>de<\/strong> manier om je bestanden toe te voegen, aangezien bijvoorbeeld de WordPress repository en veel thema-verkopers je werk niet zullen goedkeuren als je een andere manier gebruikt.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When building a plugin or a theme you will inevitably need to use stylesheets and scripts. Especially today when so many third party tools are available like CSS reset stylesheets, lightboxes, galleries &#8211; each with their own set of assets. <\/p>\n","protected":false},"author":18,"featured_media":40321,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kinsta_gated_content":false,"_kinsta_gated_content_redirect":"","footnotes":""},"tags":[29,28],"topic":[865,892],"class_list":["post-40317","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-webdev","tag-wordpress","topic-php-functie","topic-wordpress-ontwikkeling"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v24.6 (Yoast SEO v24.6) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress<\/title>\n<meta name=\"description\" content=\"Gebruik wp_enqueue_scripts in WordPress om je Javascript en CSS assets toe te voegen aan je sites terwijl je dependencies op een modulaire manier beheert.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/\" \/>\n<meta property=\"og:locale\" content=\"nl_NL\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress\" \/>\n<meta property=\"og:description\" content=\"Gebruik wp_enqueue_scripts in WordPress om je Javascript en CSS assets toe te voegen aan je sites terwijl je dependencies op een modulaire manier beheert.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/\" \/>\n<meta property=\"og:site_name\" content=\"Kinsta\u00ae\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Kinsta-Nederland-476213452787823\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-10-21T09:15:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-08T11:13:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png\" \/>\n\t<meta property=\"og:image:width\" content=\"720\" \/>\n\t<meta property=\"og:image:height\" content=\"450\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Daniel Pataki\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:description\" content=\"Gebruik wp_enqueue_scripts in WordPress om je Javascript en CSS assets toe te voegen aan je sites terwijl je dependencies op een modulaire manier beheert.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png\" \/>\n<meta name=\"twitter:creator\" content=\"@danielpataki\" \/>\n<meta name=\"twitter:site\" content=\"@Kinsta_NL\" \/>\n<meta name=\"twitter:label1\" content=\"Geschreven door\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Pataki\" \/>\n\t<meta name=\"twitter:label2\" content=\"Geschatte leestijd\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minuten\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/\"},\"author\":{\"name\":\"Daniel Pataki\",\"@id\":\"https:\/\/kinsta.com\/nl\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff\"},\"headline\":\"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress\",\"datePublished\":\"2021-10-21T09:15:59+00:00\",\"dateModified\":\"2023-06-08T11:13:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/\"},\"wordCount\":887,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/nl\/#organization\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png\",\"keywords\":[\"webdev\",\"WordPress\"],\"articleSection\":[\"WordPress ontwikkeling\"],\"inLanguage\":\"nl-NL\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/\",\"url\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/\",\"name\":\"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress\",\"isPartOf\":{\"@id\":\"https:\/\/kinsta.com\/nl\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png\",\"datePublished\":\"2021-10-21T09:15:59+00:00\",\"dateModified\":\"2023-06-08T11:13:40+00:00\",\"description\":\"Gebruik wp_enqueue_scripts in WordPress om je Javascript en CSS assets toe te voegen aan je sites terwijl je dependencies op een modulaire manier beheert.\",\"breadcrumb\":{\"@id\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#breadcrumb\"},\"inLanguage\":\"nl-NL\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"nl-NL\",\"@id\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#primaryimage\",\"url\":\"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png\",\"contentUrl\":\"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png\",\"width\":720,\"height\":450,\"caption\":\"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/kinsta.com\/nl\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress ontwikkeling\",\"item\":\"https:\/\/kinsta.com\/nl\/onderwerpen\/wordpress-ontwikkeling\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/kinsta.com\/nl\/#website\",\"url\":\"https:\/\/kinsta.com\/nl\/\",\"name\":\"Kinsta\u00ae\",\"description\":\"Snelle, veilige, premium hostingoplossingen\",\"publisher\":{\"@id\":\"https:\/\/kinsta.com\/nl\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/kinsta.com\/nl\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"nl-NL\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/kinsta.com\/nl\/#organization\",\"name\":\"Kinsta\",\"url\":\"https:\/\/kinsta.com\/nl\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"nl-NL\",\"@id\":\"https:\/\/kinsta.com\/nl\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2023\/12\/kinsta-logo.jpeg\",\"contentUrl\":\"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2023\/12\/kinsta-logo.jpeg\",\"width\":500,\"height\":500,\"caption\":\"Kinsta\"},\"image\":{\"@id\":\"https:\/\/kinsta.com\/nl\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Kinsta-Nederland-476213452787823\/\",\"https:\/\/x.com\/Kinsta_NL\",\"https:\/\/www.instagram.com\/kinstahosting\/\",\"https:\/\/www.linkedin.com\/company\/kinsta\/\",\"https:\/\/www.pinterest.com\/kinstahosting\/\",\"https:\/\/www.youtube.com\/c\/Kinsta\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/kinsta.com\/nl\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff\",\"name\":\"Daniel Pataki\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"nl-NL\",\"@id\":\"https:\/\/kinsta.com\/nl\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g\",\"caption\":\"Daniel Pataki\"},\"description\":\"Hi, my name is Daniel, I'm the CTO here at Kinsta. You may know me from Smashing Magazine, WPMU Dev, Tuts+ and other WordPress\/Development magazines. Aside from WordPress and PHP I spend most of my time around Node, React, GraphQL and other technologies in the Javascript space. When not working on making the best hosting solution in the Universe I collect board games, play table football in the office, travel or play guitar and sing in a pretty bad band.\",\"sameAs\":[\"http:\/\/danielpataki.com\",\"https:\/\/x.com\/danielpataki\"],\"url\":\"https:\/\/kinsta.com\/nl\/blog\/author\/danielpataki\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress","description":"Gebruik wp_enqueue_scripts in WordPress om je Javascript en CSS assets toe te voegen aan je sites terwijl je dependencies op een modulaire manier beheert.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/","og_locale":"nl_NL","og_type":"article","og_title":"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress","og_description":"Gebruik wp_enqueue_scripts in WordPress om je Javascript en CSS assets toe te voegen aan je sites terwijl je dependencies op een modulaire manier beheert.","og_url":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/","og_site_name":"Kinsta\u00ae","article_publisher":"https:\/\/www.facebook.com\/Kinsta-Nederland-476213452787823\/","article_published_time":"2021-10-21T09:15:59+00:00","article_modified_time":"2023-06-08T11:13:40+00:00","og_image":[{"width":720,"height":450,"url":"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png","type":"image\/png"}],"author":"Daniel Pataki","twitter_card":"summary_large_image","twitter_description":"Gebruik wp_enqueue_scripts in WordPress om je Javascript en CSS assets toe te voegen aan je sites terwijl je dependencies op een modulaire manier beheert.","twitter_image":"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png","twitter_creator":"@danielpataki","twitter_site":"@Kinsta_NL","twitter_misc":{"Geschreven door":"Daniel Pataki","Geschatte leestijd":"5 minuten"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#article","isPartOf":{"@id":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/"},"author":{"name":"Daniel Pataki","@id":"https:\/\/kinsta.com\/nl\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff"},"headline":"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress","datePublished":"2021-10-21T09:15:59+00:00","dateModified":"2023-06-08T11:13:40+00:00","mainEntityOfPage":{"@id":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/"},"wordCount":887,"commentCount":0,"publisher":{"@id":"https:\/\/kinsta.com\/nl\/#organization"},"image":{"@id":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png","keywords":["webdev","WordPress"],"articleSection":["WordPress ontwikkeling"],"inLanguage":"nl-NL","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/","url":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/","name":"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress","isPartOf":{"@id":"https:\/\/kinsta.com\/nl\/#website"},"primaryImageOfPage":{"@id":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#primaryimage"},"image":{"@id":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#primaryimage"},"thumbnailUrl":"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png","datePublished":"2021-10-21T09:15:59+00:00","dateModified":"2023-06-08T11:13:40+00:00","description":"Gebruik wp_enqueue_scripts in WordPress om je Javascript en CSS assets toe te voegen aan je sites terwijl je dependencies op een modulaire manier beheert.","breadcrumb":{"@id":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#breadcrumb"},"inLanguage":"nl-NL","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/"]}]},{"@type":"ImageObject","inLanguage":"nl-NL","@id":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#primaryimage","url":"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png","contentUrl":"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2021\/10\/wp-enqueue-scripts.png","width":720,"height":450,"caption":"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress"},{"@type":"BreadcrumbList","@id":"https:\/\/kinsta.com\/nl\/blog\/wp-enqueue-scripts\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kinsta.com\/nl\/"},{"@type":"ListItem","position":2,"name":"WordPress ontwikkeling","item":"https:\/\/kinsta.com\/nl\/onderwerpen\/wordpress-ontwikkeling\/"},{"@type":"ListItem","position":3,"name":"wp_enqueue_scripts \u2013 Enqueueing van je assets in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/kinsta.com\/nl\/#website","url":"https:\/\/kinsta.com\/nl\/","name":"Kinsta\u00ae","description":"Snelle, veilige, premium hostingoplossingen","publisher":{"@id":"https:\/\/kinsta.com\/nl\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kinsta.com\/nl\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"nl-NL"},{"@type":"Organization","@id":"https:\/\/kinsta.com\/nl\/#organization","name":"Kinsta","url":"https:\/\/kinsta.com\/nl\/","logo":{"@type":"ImageObject","inLanguage":"nl-NL","@id":"https:\/\/kinsta.com\/nl\/#\/schema\/logo\/image\/","url":"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2023\/12\/kinsta-logo.jpeg","contentUrl":"https:\/\/kinsta.com\/nl\/wp-content\/uploads\/sites\/7\/2023\/12\/kinsta-logo.jpeg","width":500,"height":500,"caption":"Kinsta"},"image":{"@id":"https:\/\/kinsta.com\/nl\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Kinsta-Nederland-476213452787823\/","https:\/\/x.com\/Kinsta_NL","https:\/\/www.instagram.com\/kinstahosting\/","https:\/\/www.linkedin.com\/company\/kinsta\/","https:\/\/www.pinterest.com\/kinstahosting\/","https:\/\/www.youtube.com\/c\/Kinsta"]},{"@type":"Person","@id":"https:\/\/kinsta.com\/nl\/#\/schema\/person\/b162216499225e1a4cdd35518f8ef0ff","name":"Daniel Pataki","image":{"@type":"ImageObject","inLanguage":"nl-NL","@id":"https:\/\/kinsta.com\/nl\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2a44c1ab807766aeaa5c8d76d4c5ea66?s=96&d=mm&r=g","caption":"Daniel Pataki"},"description":"Hi, my name is Daniel, I'm the CTO here at Kinsta. You may know me from Smashing Magazine, WPMU Dev, Tuts+ and other WordPress\/Development magazines. Aside from WordPress and PHP I spend most of my time around Node, React, GraphQL and other technologies in the Javascript space. When not working on making the best hosting solution in the Universe I collect board games, play table football in the office, travel or play guitar and sing in a pretty bad band.","sameAs":["http:\/\/danielpataki.com","https:\/\/x.com\/danielpataki"],"url":"https:\/\/kinsta.com\/nl\/blog\/author\/danielpataki\/"}]}},"acf":[],"_links":{"self":[{"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/posts\/40317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/users\/18"}],"replies":[{"embeddable":true,"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/comments?post=40317"}],"version-history":[{"count":2,"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/posts\/40317\/revisions"}],"predecessor-version":[{"id":40322,"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/posts\/40317\/revisions\/40322"}],"alternate":[{"embeddable":true,"hreflang":"en","title":"English","href":"https:\/\/kinsta.com\/nl\/wp-json\/kinsta\/v1\/posts\/40317\/translations\/en"},{"embeddable":true,"hreflang":"it","title":"Italian","href":"https:\/\/kinsta.com\/nl\/wp-json\/kinsta\/v1\/posts\/40317\/translations\/it"},{"embeddable":true,"hreflang":"de","title":"German","href":"https:\/\/kinsta.com\/nl\/wp-json\/kinsta\/v1\/posts\/40317\/translations\/de"},{"embeddable":true,"hreflang":"pt","title":"Portuguese","href":"https:\/\/kinsta.com\/nl\/wp-json\/kinsta\/v1\/posts\/40317\/translations\/pt"},{"embeddable":true,"hreflang":"fr","title":"French","href":"https:\/\/kinsta.com\/nl\/wp-json\/kinsta\/v1\/posts\/40317\/translations\/fr"},{"embeddable":true,"hreflang":"es","title":"Spanish","href":"https:\/\/kinsta.com\/nl\/wp-json\/kinsta\/v1\/posts\/40317\/translations\/es"},{"embeddable":true,"hreflang":"ja","title":"Japanese","href":"https:\/\/kinsta.com\/nl\/wp-json\/kinsta\/v1\/posts\/40317\/translations\/jp"},{"embeddable":true,"hreflang":"nl","title":"Dutch","href":"https:\/\/kinsta.com\/nl\/wp-json\/kinsta\/v1\/posts\/40317\/translations\/nl"},{"href":"https:\/\/kinsta.com\/nl\/wp-json\/kinsta\/v1\/posts\/40317\/tree"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/media\/40321"}],"wp:attachment":[{"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/media?parent=40317"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/tags?post=40317"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/kinsta.com\/nl\/wp-json\/wp\/v2\/topic?post=40317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}