{"id":122453,"date":"2015-10-07T15:57:57","date_gmt":"2015-10-07T13:57:57","guid":{"rendered":"http:\/\/designmodo.com\/?p=122453"},"modified":"2025-11-11T10:03:30","modified_gmt":"2025-11-11T10:03:30","slug":"javascript-css-wordpress","status":"publish","type":"post","link":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/","title":{"rendered":"How To Include Javascript and CSS Stylesheets in WordPress"},"content":{"rendered":"<p><strong>PHP<\/strong> is one of the easiest programming languages to learn. It powers a number of highly-trafficked websites such as Facebook, <a href=\"https:\/\/www.wikipedia.org\/\">Wikipedia<\/a> as well as popular content management systems like <a href=\"https:\/\/wordpress.org\/\">WordPress<\/a> and Drupal.<\/p>\n<p>With little knowledge of PHP, anyone can learn WordPress and become a plugin developer albeit the majority of them do not adhere to standards and best practices. Little wonder there are lots of poorly written and resource-intensive plugins in the <a href=\"https:\/\/wordpress.org\/plugins\/\">plugin directory<\/a>.<\/p>\n<p>I&#8217;ve seen a number of plugins that directly include JavaScript and CSS stylesheets like so:<\/p>\n<p>[php]<br \/>\necho &#8216;&lt;link rel=&quot;stylesheet&quot; href=&quot;https:\/\/url-to-plugin-css-folder\/style.css&quot; type=&quot;text\/css&quot; \/&gt;&#8217;;<\/p>\n<p>echo &#8216;&lt;script type=&quot;text\/javascript&quot; src=&quot;https:\/\/url-to-plugin-js-folder\/flip.js&gt;&lt;\/script&gt;&#8217;;<br \/>\n[\/php]<\/p>\n<h2>Problems with this Approach<\/h2>\n<p>There are a number of problems with this approach to the code.<\/p>\n<ul>\n<li>Inability to control where to include the components thus, stylesheet and JavaScript get included in all pages of the site. For instance, the CSS that will style or design the admin page of a plugin is added to WordPress that way; it means the CSS file will also be present in all pages of the site as a result; the browser will always download\/fetch the file even when it isn\u2019t needed.<\/li>\n<li>There exist a standard or recommended way of including JavaScript and CSS components in WordPress. Doing it your own way is considered a <strong>bad practice<\/strong>.<\/li>\n<li>Assuming every plugin that depend on jQuery include their own instance to WordPress and a number of such plugins are installed in a WP site, the consequence of this is existence of multiple instances of the jQuery. This is practice is redundant because, an instance of <a href=\"https:\/\/designmodo.com\/free-jquery-plugins\/\">jQuery would have serve the plugins<\/a> well.<\/li>\n<\/ul>\n<h2>Doing Things the Right Way<\/h2>\n<p>WordPress &#8220;ships&#8221; with a number of functions for including (enqueuing) JavaScript and CSS the right way. This is how it is done.<\/p>\n<h3>Enqueuing JavaScript<\/h3>\n<p>The following functions are available for enqueuing JavaScript in WordPress:<\/p>\n<ul>\n<li><code>wp_enqueue_script()<\/code> &#8211; Links a script file to the generated page at the right time according to the script dependencies (information on dependency later).<\/li>\n<li><code>wp_register_script()<\/code> &#8211; Registers a script in WordPress for later use.<\/li>\n<\/ul>\n<p>The <code>wp_enqueue_script()<\/code> function require the following parameters.<\/p>\n<p>[php]<br \/>\n&lt;?php wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ); ?&gt;<br \/>\n[\/php]<\/p>\n<p>Where:<\/p>\n<p><code>$handle<\/code>: What you&#8217;ll use to refer to the script wherever you might need to enqueue it.<\/p>\n<p><code>$src<\/code>: The URL of the script to be loaded i.e. the path to the source file within your plugin.<\/p>\n<p><code>$deps<\/code>: This is an array that contains the handle of any scripts that the script depends on to function. This parameter is optional. Not specifying this parameter means the script has no dependency.<\/p>\n<p><code>$ver<\/code>: The version of your script concatenated to the end of the script URL as a query string.<\/p>\n<p>If set to <code>true<\/code>, the version number will not be appended to the script URL. If you don&#8217;t use this parameter, the WordPress version will be used by default.<\/p>\n<p><code>$in_footer<\/code>: Normally, scripts are placed in header of WordPress. If this parameter is <code>true<\/code>, the script will placed before the <code><\/code> closing tag.<\/p>\n<p>Here is a basic example for loading a script:<\/p>\n<p>[php]<br \/>\nfunction plugin_javascript() {<br \/>\n\t\/\/ enqueue the script<br \/>\n\twp_enqueue_script( &#8216;base_js&#8217;, plugin_dir_url( __FILE__ ) . &#8216;base.js&#8217; );<br \/>\n}<\/p>\n<p>add_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;plugin_javascript&#8217; );<br \/>\n[\/php]<\/p>\n<p>Assuming the script depend on jQuery and jquery-ui-datepicker libraries; pass an array of the dependency as the fourth argument to the function.<\/p>\n<p>[php]<br \/>\nfunction plugin_javascript() {<br \/>\n\t\/\/ enqueue the script<br \/>\n\twp_enqueue_script( &#8216;base_js&#8217;, plugin_dir_url( __FILE__ ) . &#8216;base.js&#8217;, array(&#8216;jquery&#8217;, &#8216;jquery-ui-datepicker &#8216;) );<br \/>\n}<\/p>\n<p>add_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;plugin_javascript&#8217; );<br \/>\n[\/php]<\/p>\n<p>To append a version number to the script URL e.g. <code>1.0<\/code>, see the code below.<\/p>\n<p>[php]<br \/>\nfunction plugin_javascript() {<br \/>\n\t\/\/ enqueue the script<br \/>\n\twp_enqueue_script( &#8216;base_js&#8217;, plugin_dir_url( __FILE__ ) . &#8216;base.js&#8217;, array(&#8216;jquery&#8217;), &#8216;1.0&#8217; );<br \/>\n}<\/p>\n<p>add_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;plugin_javascript&#8217; );<br \/>\n[\/php]<\/p>\n<p>If you want to place the script at footer of WordPress, set the fourth parameter to true.<\/p>\n<p>[php]<br \/>\nfunction plugin_javascript() {<br \/>\n\t\/\/ enqueue the script<br \/>\n\twp_enqueue_script( &#8216;base_js&#8217;, plugin_dir_url( __FILE__ ) . &#8216;base.js&#8217;, array(&#8216;jquery&#8217;), &#8216;1.0&#8217;, true );<br \/>\n}<\/p>\n<p>add_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;plugin_javascript&#8217; );<br \/>\n[\/php]<\/p>\n<p><strong>Note:<\/strong> <code>wp_enqueue_script<\/code> and <code>wp_register_script<\/code> are similar in that they have the same function parameters. The only difference is while the former load a script immediately, the latter loads the script for reuse later.<\/p>\n<p>WordPress includes <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_enqueue_script\/#Default_Scripts_Included_and_Registered_by_WordPress\">many popular scripts<\/a> commonly used by web developers besides the ones internally used by WordPress itself.<\/p>\n<p>Instead of including your own version of the <a href=\"https:\/\/developer.wordpress.org\/reference\/functions\/wp_enqueue_script\/#Default_Scripts_Included_and_Registered_by_WordPress\" target=\"_blank\" rel=\"noopener noreferrer\">registered libraries<\/a>, simply enqueue any of them and WordPress will remove any redundancy and ensure only an instance of the script is loaded.<\/p>\n<p>For example, if your plugin requires the Jcrop library, do not include your own version of script; instead, enqueue the registered one.<\/p>\n<p>[php]<br \/>\nfunction jcrop_lib() {<br \/>\n\twp_enqueue_script( &#8216;jcrop&#8217;);<br \/>\n}<\/p>\n<p>add_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;jcrop_lib&#8217; );<br \/>\n[\/php]<\/p>\n<p><strong>Note:<\/strong> When you enqueue a registered script (jcrop) that depend on another script (jQuery), WordPress automatically handles the dependency troubles.<\/p>\n<h3>Enqueuing CSS Stylesheet<\/h3>\n<p><code>wp_enqueue_style()<\/code> and <code>wp_register_style()<\/code> is to CSS what <code>wp_enqueue_script()<\/code> and <code>wp_register_script()<\/code> is to JavaScript.<\/p>\n<h4>Function Synopsis<\/h4>\n<p>[php]<br \/>\n&lt;?php wp_enqueue_style( $handle, $src, $deps, $ver, $media ); ?&gt;<br \/>\n[\/php]<\/p>\n<p>[php]<br \/>\n&lt;?php wp_register_style( $handle, $src, $deps, $ver, $media ); ?&gt;<br \/>\n[\/php]<\/p>\n<p>Where:<\/p>\n<p><code>$handle<\/code> Stylesheet handle name.<\/p>\n<p><code>$src<\/code> &#8211; URL to the stylesheet.<\/p>\n<p><code>$deps<\/code> &#8211; Array stylesheet handles that the stylesheet depends on.<\/p>\n<p><code>$ver<\/code> &#8211; Stylesheet version number.<\/p>\n<p><code>$media<\/code> &#8211; The media for which this stylesheet has been defined. Examples: &#8216;all&#8217;, &#8216;screen&#8217;, &#8216;handheld&#8217;, &#8216;print&#8217;.<\/p>\n<p>Here&#8217;s how to safely add\/enqueue a CSS file to WordPress.<\/p>\n<p>[php]<br \/>\nfunction plugin_css() {<br \/>\n\twp_enqueue_style( &#8216;css-handle&#8217;, plugin_dir_url( __FILE__ ) . &#8216;style.css&#8217; );<br \/>\n}<\/p>\n<p>add_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;plugin_css&#8217; );<br \/>\n[\/php]<\/p>\n<p>Here&#8217;s how to register a CSS style file for later via <code>wp_register_style()<\/code>.<\/p>\n<p>[php]<br \/>\nadd_action( &#8216;wp_enqueue_scripts&#8217;, &#8216;register_plugin_styles&#8217; );<\/p>\n<p>function plugin_styles() {<br \/>\n\t\/\/ Register the css for later use<br \/>\n\twp_register_style( &#8216;my-plugin&#8217;, plugins_url( &#8216;my-plugin\/css\/plugin.css&#8217; ) );<\/p>\n<p>\t\/\/ use the css now<br \/>\n\twp_enqueue_style( &#8216;my-plugin&#8217; );<br \/>\n}<br \/>\n[\/php]<\/p>\n<h2>Stop Enqueuing Everywhere<\/h2>\n<p>The code examples we&#8217;ve seen so far uses the <a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/wp_enqueue_scripts\/\">wp_enqueue_scripts<\/a> action to enqueuing items meant to be loaded on the front end.<\/p>\n<p>To load a set of CSS and\/or JavaScript documents to all admin pages, use the <a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/admin_enqueue_scripts\/\">admin_enqueue_scripts<\/a> action as follows:<\/p>\n<p>[php]<br \/>\nfunction load_custom_wp_admin_style() {<br \/>\n\twp_register_style( &#8216;custom_wp_admin_css&#8217;, plugins_url( &#8216;my-plugin\/admin-style.css&#8217; ), false, &#8216;1.0&#8217; );<br \/>\n\twp_enqueue_style( &#8216;custom_wp_admin_css&#8217; );<br \/>\n}<br \/>\nadd_action( &#8216;admin_enqueue_scripts&#8217;, &#8216;load_custom_wp_admin_style&#8217; );<br \/>\n[\/php]<\/p>\n<p>To enqueue items that are meant to appear on the login page, use <a href=\"https:\/\/developer.wordpress.org\/reference\/hooks\/login_enqueue_scripts\/\">login_enqueue_scripts<\/a>.<\/p>\n<p>[php]<br \/>\nfunction login_style_script() {<br \/>\n\twp_register_style( &#8216;login_css&#8217;, plugins_url( &#8216;my-plugin\/login.css&#8217; ), false, &#8216;1.0&#8217; );<br \/>\n\twp_enqueue_style( &#8216;login_css&#8217; );<\/p>\n<p>\twp_enqueue_script( &#8216;scriptaculous&#8217; );<br \/>\n}<br \/>\nadd_action( &#8216;login_enqueue_scripts&#8217;, &#8216;load_custom_wp_admin_style&#8217; );<br \/>\n[\/php]<\/p>\n<h3>Wrap Up<\/h3>\n<p>If a standard is available for doing anything, it is recommended you adhere to them because they were created with a lot of thought by people who probably understand it better than you might.<\/p>\n<p>I hope this tutorial will help you better understand how to <strong>Enqueue Scripts<\/strong> in WordPress properly.<\/p>\n<p>If there is anything you don&#8217;t understand or you have a question, feel free to let us know in the comments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PHP is one of the easiest programming languages to learn. It powers a number of highly-trafficked websites such as Facebook, Wikipedia as well as popular content management systems like WordPress and Drupal. With little knowledge of PHP, anyone can learn WordPress and become a plugin developer albeit the majority of them do not adhere to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":280240,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-122453","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How To Include Javascript and CSS Stylesheets in WordPress - WordPress Guides<\/title>\n<meta name=\"description\" content=\"I&#039;ve seen a number of plugin that directly include JavaScript and CSS stylesheets. With little knowledge of PHP, anyone can learn WordPress and become a plugin developer.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How To Include Javascript and CSS Stylesheets in WordPress - WordPress Guides\" \/>\n<meta property=\"og:description\" content=\"I&#039;ve seen a number of plugin that directly include JavaScript and CSS stylesheets. With little knowledge of PHP, anyone can learn WordPress and become a plugin developer.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"WordPress Guides\" \/>\n<meta property=\"article:published_time\" content=\"2015-10-07T13:57:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-11T10:03:30+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/designmodo.com\/wp-content\/uploads\/2015\/10\/wordpress-css-javascript.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3\"},\"headline\":\"How To Include Javascript and CSS Stylesheets in WordPress\",\"datePublished\":\"2015-10-07T13:57:57+00:00\",\"dateModified\":\"2025-11-11T10:03:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/\"},\"wordCount\":1223,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#organization\"},\"image\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"\",\"articleSection\":[\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/\",\"url\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/\",\"name\":\"How To Include Javascript and CSS Stylesheets in WordPress - WordPress Guides\",\"isPartOf\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#primaryimage\"},\"thumbnailUrl\":\"\",\"datePublished\":\"2015-10-07T13:57:57+00:00\",\"dateModified\":\"2025-11-11T10:03:30+00:00\",\"description\":\"I've seen a number of plugin that directly include JavaScript and CSS stylesheets. With little knowledge of PHP, anyone can learn WordPress and become a plugin developer.\",\"breadcrumb\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/strictthemes.com\/articles\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How To Include Javascript and CSS Stylesheets in WordPress\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#website\",\"url\":\"https:\/\/strictthemes.com\/articles\/\",\"name\":\"WordPress Guides\",\"description\":\"Create WordPress websites for begginers.\",\"publisher\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/strictthemes.com\/articles\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#organization\",\"name\":\"WordPress Guides\",\"url\":\"https:\/\/strictthemes.com\/articles\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png\",\"contentUrl\":\"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png\",\"width\":500,\"height\":500,\"caption\":\"WordPress Guides\"},\"image\":{\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/strictthemes.com\/articles\"],\"url\":\"https:\/\/strictthemes.com\/articles\/author\/andrian\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How To Include Javascript and CSS Stylesheets in WordPress - WordPress Guides","description":"I've seen a number of plugin that directly include JavaScript and CSS stylesheets. With little knowledge of PHP, anyone can learn WordPress and become a plugin developer.","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:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/","og_locale":"en_US","og_type":"article","og_title":"How To Include Javascript and CSS Stylesheets in WordPress - WordPress Guides","og_description":"I've seen a number of plugin that directly include JavaScript and CSS stylesheets. With little knowledge of PHP, anyone can learn WordPress and become a plugin developer.","og_url":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/","og_site_name":"WordPress Guides","article_published_time":"2015-10-07T13:57:57+00:00","article_modified_time":"2025-11-11T10:03:30+00:00","author":"admin","twitter_card":"summary_large_image","twitter_image":"https:\/\/designmodo.com\/wp-content\/uploads\/2015\/10\/wordpress-css-javascript.jpg","twitter_misc":{"Written by":"admin","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#article","isPartOf":{"@id":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/"},"author":{"name":"admin","@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3"},"headline":"How To Include Javascript and CSS Stylesheets in WordPress","datePublished":"2015-10-07T13:57:57+00:00","dateModified":"2025-11-11T10:03:30+00:00","mainEntityOfPage":{"@id":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/"},"wordCount":1223,"commentCount":1,"publisher":{"@id":"https:\/\/strictthemes.com\/articles\/#organization"},"image":{"@id":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#primaryimage"},"thumbnailUrl":"","articleSection":["WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/","url":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/","name":"How To Include Javascript and CSS Stylesheets in WordPress - WordPress Guides","isPartOf":{"@id":"https:\/\/strictthemes.com\/articles\/#website"},"primaryImageOfPage":{"@id":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#primaryimage"},"image":{"@id":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#primaryimage"},"thumbnailUrl":"","datePublished":"2015-10-07T13:57:57+00:00","dateModified":"2025-11-11T10:03:30+00:00","description":"I've seen a number of plugin that directly include JavaScript and CSS stylesheets. With little knowledge of PHP, anyone can learn WordPress and become a plugin developer.","breadcrumb":{"@id":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#primaryimage","url":"","contentUrl":""},{"@type":"BreadcrumbList","@id":"https:\/\/strictthemes.com\/articles\/javascript-css-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/strictthemes.com\/articles\/"},{"@type":"ListItem","position":2,"name":"How To Include Javascript and CSS Stylesheets in WordPress"}]},{"@type":"WebSite","@id":"https:\/\/strictthemes.com\/articles\/#website","url":"https:\/\/strictthemes.com\/articles\/","name":"WordPress Guides","description":"Create WordPress websites for begginers.","publisher":{"@id":"https:\/\/strictthemes.com\/articles\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/strictthemes.com\/articles\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/strictthemes.com\/articles\/#organization","name":"WordPress Guides","url":"https:\/\/strictthemes.com\/articles\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/","url":"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png","contentUrl":"https:\/\/strictthemes.com\/articles\/wp-content\/uploads\/2021\/02\/logo.png","width":500,"height":500,"caption":"WordPress Guides"},"image":{"@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/strictthemes.com\/articles\/#\/schema\/person\/0494d35a2138fb6ca85de8d8c107cea3","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0f3e4f16181fb8c4f52d8ce92b721be0a10c6988bdb5a145b784cde45f5ef679?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/strictthemes.com\/articles"],"url":"https:\/\/strictthemes.com\/articles\/author\/andrian\/"}]}},"_links":{"self":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts\/122453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/comments?post=122453"}],"version-history":[{"count":3,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts\/122453\/revisions"}],"predecessor-version":[{"id":690222,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/posts\/122453\/revisions\/690222"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/media?parent=122453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/categories?post=122453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/strictthemes.com\/articles\/wp-json\/wp\/v2\/tags?post=122453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}