{"id":15788,"date":"2011-11-24T00:44:34","date_gmt":"2011-11-24T00:44:34","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/wp-autoload\/"},"modified":"2012-09-22T14:28:42","modified_gmt":"2012-09-22T14:28:42","slug":"wp-autoload","status":"publish","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/wp-autoload\/","author":8584657,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"2.5.1","stable_tag":"2.5.1","tested":"3.4.2","requires":"3.2.0","requires_php":"","requires_plugins":"","header_name":"WP Autoload","header_author":"Charles Lecklider","header_description":"","assets_banners_color":"","last_updated":"2012-09-22 14:28:42","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/charles.lecklider.org\/wordpress\/wp-autoload","header_author_uri":"https:\/\/charles.lecklider.org\/","rating":0,"author_block_rating":0,"active_installs":0,"downloads":1839,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":{"1.1.0":"<ul>\n<li>Improved template part list filtering.<\/li>\n<\/ul>","1.0.4":"<ul>\n<li>Stable release.<\/li>\n<\/ul>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0","1.0.1","1.0.2","1.0.3","1.0.4","1.1.0","1.1.1","2.0.0","2.1.0","2.1.1","2.1.2","2.1.3","2.5.0","2.5.1"],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[356,229,4516,1141],"plugin_category":[43,59],"plugin_contributors":[],"plugin_business_model":[],"class_list":["post-15788","plugin","type-plugin","status-publish","hentry","plugin_tags-css","plugin_tags-javascript","plugin_tags-templates","plugin_tags-theme","plugin_category-customization","plugin_category-utilities-and-tools","plugin_committers-invisnet"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/wp-autoload.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>Most themes have a single stylesheet, a few JavaScript files, and all the PHP in <code>functions.php<\/code>. <em>WP Autoload<\/em> makes it trivial for theme developers to split up CSS, JS, and PHP per template, simplifying development and maintenance. It also makes it much easier to write per-template unit tests.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload the plugin to your plugins directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Check the settings on the configuration page (Settings -&gt; WP Autoload)<\/li>\n<\/ol>\n\n<!--section=faq-->\n<h4>How do I use this in my theme?<\/h4>\n <p><em>WP Autoload<\/em> looks for files in the same way WordPress looks for templates, but it also loads 'parent' files. Say your theme looks like this:<\/p>\n <pre><code>themes\/   foobar\/     css\/       archive.css       page.css       page-bar.css     inc\/       page.php       page-bar.php     js\/       archive.js       page.js       page-bar.js <\/code><\/pre>\n <p>For an archive page, <em>WP Autoload<\/em> will load:<\/p>\n <ul>\n<li><code>css\/archive.css<\/code><\/li>\n<li><code>js\/archive.js<\/code><\/li>\n<\/ul>\n <p>No surprises there.<\/p>\n <p>For a normal page, <em>WP Autoload<\/em> will load:<\/p>\n <ul>\n<li><code>css\/page.css<\/code><\/li>\n<li><code>inc\/page.php<\/code><\/li>\n<li><code>js\/page.js<\/code><\/li>\n<\/ul>\n <p><em>WP Autoload<\/em> will then try to create a new <code>WP_Autoload_page<\/code> object. The class <strong>must<\/strong> extend <code>WP_Autoload_Template<\/code>, e.g.:<\/p>\n <pre><code>class WP_Autoload_page extends WP_Autoload_Template {   ... } <\/code><\/pre>\n <p>For a page with a slug of <code>bar<\/code>, <em>WP Autoload<\/em> will load:<\/p>\n <ul>\n<li><code>page.css<\/code> <em>and<\/em> <code>page-bar.css<\/code>, with <code>page.css<\/code> as a dependency of <code>page-bar.css<\/code><\/li>\n<li><code>page.php<\/code> <em>and<\/em> <code>page-bar.php<\/code>, in that order<\/li>\n<li><code>page.js<\/code> <em>and<\/em> <code>page-bar.js<\/code>, with <code>page.js<\/code> as a dependency of <code>page-bar.js<\/code><\/li>\n<\/ul>\n <p><em>WP Autoload<\/em> will then try to create a new <code>WP_Autoload_page_bar<\/code> object; because <code>page.php<\/code> is loaded first you can do this:<\/p>\n <pre><code>class WP_Autoload_page_bar extends WP_Autoload_page {   ... } <\/code><\/pre>\n <h4>What about performance?<\/h4>\n <p>For templates where there is no specific stylesheet or script file the performance implications of <em>WP Autoload<\/em> are negligible. For templates with both a specific stylesheet and script file <em>WP Autoload<\/em> will add two requests to the overall page load sequence. Typically these extra requests have no significant impact on page load time because they are offset by the reduced size of the common stylesheet.<\/p>\n\n<!--section=changelog-->\n<h4>2.5.0<\/h4>\n <ul>\n<li>Support for hierarchical post types.<\/li>\n<\/ul>\n <h4>2.1.3<\/h4>\n <ul>\n<li>Bugfix: fix debug warning with E_ALL.<\/li>\n<\/ul>\n <h4>2.1.2<\/h4>\n <ul>\n<li>Bugfix: fix loading base classes.<\/li>\n<\/ul>\n <h4>2.1.1<\/h4>\n <ul>\n<li>Bugfix: remove debug code.<\/li>\n<\/ul>\n <h4>2.1.0<\/h4>\n <ul>\n<li>Support for child themes.<\/li>\n<\/ul>\n <h4>2.0.0<\/h4>\n <ul>\n<li>Per-template classes.<\/li>\n<li>Better sidebar handling.<\/li>\n<\/ul>\n <h4>1.1.1<\/h4>\n <ul>\n<li>Dependencies configuration bug fix.<\/li>\n<\/ul>\n <h4>1.1.0<\/h4>\n <ul>\n<li>Improved template part list filtering.<\/li>\n<\/ul>\n <h4>1.0.4<\/h4>\n <ul>\n<li>Add enqueue_script() method to allow scripts to be enqueued after wp_head().<\/li>\n<\/ul>\n <h4>1.0.3<\/h4>\n <ul>\n<li>Tag fix.<\/li>\n<\/ul>\n <h4>1.0.2<\/h4>\n <ul>\n<li>Handle single dependencies better.<\/li>\n<\/ul>\n <h4>1.0.1<\/h4>\n <ul>\n<li>Fix minor PHP warning.<\/li>\n<\/ul>\n <h4>1.0<\/h4>\n <ul>\n<li>Initial release.<\/li>\n<\/ul>","raw_excerpt":"Automatically load per-template JavaScript, CSS, and PHP files.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/15788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=15788"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/invisnet"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=15788"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=15788"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=15788"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=15788"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=15788"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=15788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}