{"id":81164,"date":"2018-02-05T17:45:49","date_gmt":"2018-02-05T17:45:49","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/sectors-conditional-templates-hooks\/"},"modified":"2024-07-28T07:14:19","modified_gmt":"2024-07-28T07:14:19","slug":"sectors","status":"publish","type":"plugin","link":"https:\/\/bal.wordpress.org\/plugins\/sectors\/","author":6422329,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.2","stable_tag":"trunk","tested":"6.6.5","requires":"4.8","requires_php":"5.6","requires_plugins":null,"header_name":"Sectors - Conditional Templates & Hooks","header_author":"Joachim Jensen","header_description":"Add templates, actions, and filters depending on the context.","assets_banners_color":"ba469b","last_updated":"2024-07-28 07:14:19","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"https:\/\/dev.institute\/wordpress-sectors\/","header_author_uri":"https:\/\/dev.institute","rating":0,"author_block_rating":0,"active_installs":10,"downloads":1552,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":2064763,"resolution":"128x128","location":"assets","locale":""},"icon-256x256.png":{"filename":"icon-256x256.png","revision":2064763,"resolution":"256x256","location":"assets","locale":""}},"assets_banners":{"banner-1544x500.png":{"filename":"banner-1544x500.png","revision":2064763,"resolution":"1544x500","location":"assets","locale":""},"banner-772x250.png":{"filename":"banner-772x250.png","revision":2064763,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":1828108,"resolution":"1","location":"assets","locale":""},"screenshot-2.png":{"filename":"screenshot-2.png","revision":1828108,"resolution":"2","location":"assets","locale":""}},"screenshots":{"1":"Actions &amp; Filters without Sectors","2":"Actions &amp; Filters using Sectors"},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[2423,152765,2755,4073],"plugin_category":[],"plugin_contributors":[78633,78632],"plugin_business_model":[],"class_list":["post-81164","plugin","type-plugin","status-publish","hentry","plugin_tags-actions","plugin_tags-conditional-templates","plugin_tags-filters","plugin_tags-hooks","plugin_contributors-devinstitute","plugin_contributors-intoxstudio","plugin_committers-intoxstudio"],"banners":{"banner":"https:\/\/ps.w.org\/sectors\/assets\/banner-772x250.png?rev=2064763","banner_2x":"https:\/\/ps.w.org\/sectors\/assets\/banner-1544x500.png?rev=2064763","banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/sectors\/assets\/icon-128x128.png?rev=2064763","icon_2x":"https:\/\/ps.w.org\/sectors\/assets\/icon-256x256.png?rev=2064763","generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/sectors\/assets\/screenshot-1.png?rev=1828108","caption":"Actions &amp; Filters without Sectors"},{"src":"https:\/\/ps.w.org\/sectors\/assets\/screenshot-2.png?rev=1828108","caption":"Actions &amp; Filters using Sectors"}],"raw_content":"<!--section=description-->\n<p>Sectors is a first of its kind plugin for WordPress. Create theme templates for any context on your site. Make sure select Actions or Filters are only added when certain conditions are met.<\/p>\n\n<h4>Contexts<\/h4>\n\n<p>When you add a new sector to your site, you select the content it covers. This could be:<\/p>\n\n<ul>\n<li>All posts in a select category<\/li>\n<li>Pages by an author<\/li>\n<li>Custom Post Types with a Custom Taxonomy<\/li>\n<li>...<\/li>\n<li>Any combination of above<\/li>\n<\/ul>\n\n<p>Sectors also comes with built in support for BuddyPress, WPML, Polylang, and more.<\/p>\n\n<h4>Templates<\/h4>\n\n<p>Sectors will look in your theme folder for the following templates:<\/p>\n\n<ul>\n<li><code>\/sectors\/&lt;sector-name&gt;.php<\/code><\/li>\n<li><code>\/sector-&lt;sector-name&gt;.php<\/code><\/li>\n<\/ul>\n\n<p>If found, it will be automatically loaded for the context.<\/p>\n\n<h4>API<\/h4>\n\n<p><strong>Template Tags<\/strong><\/p>\n\n<p>Check if a query is part of a given or any sector:<\/p>\n\n<pre><code>is_sector(string $sector):boolean\n<\/code><\/pre>\n\n<p>Get all sectors for current context:<\/p>\n\n<pre><code>get_current_sectors():array\n<\/code><\/pre>\n\n<p><strong>Hooks<\/strong><\/p>\n\n<p>Sectors extends all WordPress Actions and Filters by adding a scope. This means you can add a callback to an action and make sure it's only executed in a given context:<\/p>\n\n<pre><code>add_sector_action(string $sector, string $tag, callable $function, int $priority = 10, int $accepted_args = 1 )\n\nadd_sector_filter(string $sector, string $tag, callable $function, int $priority = 10, int $accepted_args = 1 )\n<\/code><\/pre>\n\n<!--section=installation-->\n<ol>\n<li>Upload the full plugin directory to your <code>\/wp-content\/plugins\/<\/code> directory or install the plugin through <code>Plugins<\/code> in the Admin Dashboard<\/li>\n<li>Activate the plugin through <code>Plugins<\/code> in the Admin Dashboard<\/li>\n<li>Create your first Sector under the menu <em>Sectors &gt; Add New<\/em><\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>1.2<\/h4>\n\n<ul>\n<li>Added: wordpress 5.5 support<\/li>\n<li>Added: minimum wordpress version 4.8<\/li>\n<li>Added: minimum php version 5.6<\/li>\n<li>Updated: wp-content-aware-engine<\/li>\n<li>Updated: wp-db-updater<\/li>\n<\/ul>\n\n<h4>1.1<\/h4>\n\n<ul>\n<li>Added: api to get current sectors<\/li>\n<li>Added: 'sector' to body class<\/li>\n<li>Added: ui improvements<\/li>\n<li>Updated: wp-content-aware-engine<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>Welcome<\/li>\n<\/ul>","raw_excerpt":"What if you could add templates, actions, and filters depending on the context?","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/81164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=81164"}],"author":[{"embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/intoxstudio"}],"wp:attachment":[{"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=81164"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=81164"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=81164"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=81164"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=81164"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/bal.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=81164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}